1.0.4.36: Commit Kevin Reid's "safer *break-on-signals*" patch.
authorNathan Froyd <froydnj@cs.rice.edu>
Sat, 7 Apr 2007 01:13:23 +0000 (01:13 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Sat, 7 Apr 2007 01:13:23 +0000 (01:13 +0000)
NEWS
src/code/cold-error.lisp
tests/break-on-signals.impure.lisp [new file with mode: 0644]
version.lisp-expr

diff --git a/NEWS b/NEWS
index f25fa38..6abedd4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ changes in sbcl-1.0.5 relative to sbcl-1.0.4:
   * bug fix: some GC deadlocks caused by asynchronous interrupts have
     been fixed by inhibiting interrupts for when GC is disbled.
   * bug fix: GETHASH, PUTHASH, CLRHASH and REMHASH are now interrupt safe.
+  * bug fix: binding *BREAK-ON-SIGNALS* to a value that is not a type
+    specifier no longer causes infinite recursion.
   * improvement: the x86-64/darwin port now passes all tests and
     should be considered non-experimental.
 
index 4295160..96a5670 100644 (file)
                                         'simple-condition
                                         'signal))
         (*handler-clusters* *handler-clusters*)
-        (old-bos *break-on-signals*))
+        (old-bos *break-on-signals*)
+        (bos-actually-breaking nil))
     (restart-case
-        (when (typep condition *break-on-signals*)
-          (let ((*break-on-signals* nil))
+        (let ((break-on-signals *break-on-signals*)
+              (*break-on-signals* nil))
+          ;; The rebinding encloses the TYPEP so that a bogus
+          ;; type specifier will not lead to infinite recursion when
+          ;; TYPEP fails.
+          (when (typep condition break-on-signals)
+            (setf bos-actually-breaking t)
             (break "~A~%BREAK was entered because of *BREAK-ON-SIGNALS* ~
                     (now rebound to NIL)."
                    condition)))
       ;; unless we provide this restart.)
       (reassign (new-value)
         :report
-        "Return from BREAK and assign a new value to *BREAK-ON-SIGNALS*."
+        (lambda (stream)
+          (format stream
+                  (if bos-actually-breaking
+                    "Return from BREAK and assign a new value to ~
+                     *BREAK-ON-SIGNALS*."
+                    "Assign a new value to *BREAK-ON-SIGNALS* and ~
+                     continue with signal handling.")))
         :interactive
         (lambda ()
           (let (new-value)
diff --git a/tests/break-on-signals.impure.lisp b/tests/break-on-signals.impure.lisp
new file mode 100644 (file)
index 0000000..0c0b5c2
--- /dev/null
@@ -0,0 +1,25 @@
+;;;; This software is part of the SBCL system. See the README file for
+;;;; more information.
+;;;;
+;;;; While most of SBCL is derived from the CMU CL system, the test
+;;;; files (like this one) were written from scratch after the fork
+;;;; from CMU CL.
+;;;;
+;;;; This software is in the public domain and is provided with
+;;;; absolutely no warranty. See the COPYING and CREDITS files for
+;;;; more information.
+
+(cl:in-package :cl-user)
+
+;;; If *BREAK-ON-SIGNALS* has a bogus value, don't go off in an infinite
+;;; recursion.
+(assert
+  (catch 'ok
+    (handler-bind
+        ((error
+          (lambda (condition)
+            (when (search "NOT-A-TYPE-SPECIFIER" (princ-to-string condition))
+              (throw 'ok t)))))
+      (let ((*break-on-signals* '#:not-a-type-specifier))
+        (signal "foo"))
+    nil)))
index 9120577..21f3d48 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.4.35"
+"1.0.4.36"