Skip to content

Commit

Permalink
1.0.31.3: fix saving runtime options from executable cores
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
nikodemus committed Sep 11, 2009
1 parent 9e0cc7f commit 704fd58
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
5 changes: 5 additions & 0 deletions 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
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/coreparse.c
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tests/core.test.sh
Expand Up @@ -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
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -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"

0 comments on commit 704fd58

Please sign in to comment.