1.0.11.1: Handle set-but-empty environment variables
authorRudi Schlatte <rudi@constantly.at>
Fri, 26 Oct 2007 04:33:34 +0000 (04:33 +0000)
committerRudi Schlatte <rudi@constantly.at>
Fri, 26 Oct 2007 04:33:34 +0000 (04:33 +0000)
  ... SBCL_HOME= sbcl crashed on startup
  ... Patch by Michael Weber

contrib/asdf-install/installer.lisp
contrib/asdf/asdf.lisp
contrib/sb-grovel/def-to-lisp.lisp
src/code/filesys.lisp
src/runtime/runtime.c
version.lisp-expr

index 0af1455..b43f15a 100644 (file)
@@ -2,8 +2,9 @@
 
 (defvar *proxy* (posix-getenv "http_proxy"))
 (defvar *cclan-mirror*
-  (or (posix-getenv "CCLAN_MIRROR")
-      "http://ftp.linux.org.uk/pub/lisp/cclan/"))
+  (let ((mirror (posix-getenv "CCLAN_MIRROR")))
+    (or (and (not (string= mirror "")) mirror)
+        "http://ftp.linux.org.uk/pub/lisp/cclan/")))
 
 (defun directorify (name)
   ;; input name may or may not have a training #\/, but we know we
index 4005dc8..b1ad184 100644 (file)
@@ -1191,7 +1191,7 @@ output to *VERBOSE-OUT*.  Returns the shell's exit code."
 
   (defun contrib-sysdef-search (system)
     (let ((home (sb-ext:posix-getenv "SBCL_HOME")))
-      (when home
+      (when (and home (not (string= home "")))
         (let* ((name (coerce-name system))
                (home (truename home))
                (contrib (merge-pathnames
@@ -1205,7 +1205,7 @@ output to *VERBOSE-OUT*.  Returns the shell's exit code."
 
   (pushnew
    '(let ((home (sb-ext:posix-getenv "SBCL_HOME")))
-      (when home
+      (when (and home (not (string= home "")))
         (merge-pathnames "site-systems/" (truename home))))
    *central-registry*)
 
index 30265a0..aa13f2e 100644 (file)
@@ -187,7 +187,8 @@ code:
     (funcall (intern "C-CONSTANTS-EXTRACT" (find-package "SB-GROVEL"))
              filename tmp-c-source (constants-package component))
     (unless (do-not-grovel component)
-      (let* ((cc (or (sb-ext:posix-getenv "CC")
+      (let* ((cc (or (and (string/= (sb-ext:posix-getenv "CC") "")
+                          (sb-ext:posix-getenv "CC"))
                      ;; It might be nice to include a CONTINUE or
                      ;; USE-VALUE restart here, but ASDF seems to insist
                      ;; on handling the errors itself.
index 53ff874..b166710 100644 (file)
@@ -572,7 +572,7 @@ otherwise. An error of type FILE-ERROR is signaled if pathname is wild."
 (defun sbcl-homedir-pathname ()
   (let ((sbcl-home (posix-getenv "SBCL_HOME")))
     ;; SBCL_HOME isn't set for :EXECUTABLE T embedded cores
-    (when sbcl-home
+    (when (and sbcl-home (not (string= sbcl-home "")))
       (parse-native-namestring
        (ensure-trailing-slash sbcl-home)))))
 
@@ -587,8 +587,7 @@ system."
   (let ((env-home (posix-getenv "HOME")))
     (parse-native-namestring
      (ensure-trailing-slash
-      (if (and env-home
-               (not (equal env-home "")))
+      (if (and env-home (not (string= env-home "")))
           env-home
           #!-win32
           (sb!unix:uid-homedir (sb!unix:unix-getuid))
index 5db1453..a4fc68a 100644 (file)
@@ -194,7 +194,7 @@ search_for_core ()
     char *stem = "/sbcl.core";
     char *core;
 
-    if(!sbcl_home) sbcl_home = SBCL_HOME;
+    if (!(sbcl_home && *sbcl_home)) sbcl_home = SBCL_HOME;
     lookhere = (char *) calloc(strlen(sbcl_home) +
                                strlen(stem) +
                                1,
@@ -234,6 +234,7 @@ main(int argc, char *argv[], char *envp[])
     boolean end_runtime_options = 0;
 
     lispobj initial_function;
+    const char *sbcl_home = getenv("SBCL_HOME");
 
     interrupt_init();
     block_blockable_signals();
@@ -361,8 +362,9 @@ main(int argc, char *argv[], char *envp[])
        }
     }
 
-    /* Make sure that SBCL_HOME is set, unless loading an embedded core. */
-    if (!getenv("SBCL_HOME") && embedded_core_offset == 0) {
+    /* Make sure that SBCL_HOME is set and not the empty string,
+       unless loading an embedded core. */
+    if (!(sbcl_home && *sbcl_home) && embedded_core_offset == 0) {
         char *envstring, *copied_core, *dir;
         char *stem = "SBCL_HOME=";
         copied_core = copied_string(core);
index 083bda7..687c82f 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.11"
+"1.0.11.1"