1.0.31.3: fix saving runtime options from executable cores
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 11 Sep 2009 13:19:59 +0000 (13:19 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 11 Sep 2009 13:19:59 +0000 (13:19 +0000)
  Runtime options used to be clobbered from the executable core even
  if there were none saved there.

  Patch by Zach Beane.

  Fixes https://bugs.launchpad.net/sbcl/+bug/411925

NEWS
src/runtime/coreparse.c
tests/core.test.sh
version.lisp-expr

diff --git a/NEWS b/NEWS
index 543c78d..3197559 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,9 @@
 ;;;; -*- coding: utf-8; fill-column: 78 -*-
+changes relative to sbcl-1.0.31
+  * bug fix: SAVE-LISP-AND-DIE option :SAVE-RUNTIME-OPTIONS did not work
+    correctly when starting from an executable core without saved runtime
+    options (reported by Faré Rideau, thanks to Zach Beane)
+
 changes in sbcl-1.0.31 relative to sbcl-1.0.30:
   * improvement: stack allocation is should now be possible in all nested
     inlining cases: failure to stack allocate when equivalent code is manually
index e8a513b..3ccdc23 100644 (file)
@@ -83,12 +83,16 @@ read_runtime_options(int fd)
 void
 maybe_initialize_runtime_options(int fd)
 {
+    struct runtime_options *new_runtime_options;
     off_t end_offset = sizeof(lispobj) +
         sizeof(os_vm_offset_t) +
         (RUNTIME_OPTIONS_WORDS * sizeof(size_t));
 
     lseek(fd, -end_offset, SEEK_END);
-    runtime_options = read_runtime_options(fd);
+
+    if (new_runtime_options = read_runtime_options(fd)) {
+        runtime_options = new_runtime_options;
+    }
 }
 
 /* Search 'filename' for an embedded core.  An SBCL core has, at the
index 7393645..b483b68 100644 (file)
@@ -85,4 +85,23 @@ else
   exit 1
 fi
 
+# saving runtime options _from_ executable cores
+run_sbcl <<EOF
+  (save-lisp-and-die "$tmpcore" :executable t)
+EOF
+chmod u+x "$tmpcore"
+./"$tmpcore" --no-userinit <<EOF 
+  (save-lisp-and-die "$tmpcore" :executable t :save-runtime-options t)
+EOF
+chmod u+x "$tmpcore"
+./"$tmpcore" --version --eval '(sb-ext:quit)' <<EOF
+  (when (equal *posix-argv* '("./$tmpcore" "--version" "--eval" "(sb-ext:quit)"))
+    (sb-ext:quit :unix-status 42))
+EOF
+status=$?
+if [ $status != 42 ]; then
+    echo "saving runtime options from executable failed"
+    exit 1
+fi
+
 exit $EXIT_TEST_WIN
index d0a3d2e..7329149 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.31.2"
+"1.0.31.3"