1.0.45.26: fix a long-standing UNINTERN bug
authorNikodemus Siivola <nikodemus@random-state.net>
Sat, 12 Feb 2011 15:45:38 +0000 (15:45 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sat, 12 Feb 2011 15:45:38 +0000 (15:45 +0000)
  Patch by Stas Boukarev, lp#693796.

  UNINTERN is specified to take a symbol, not a symbol
  designator: if P1 has the symbol P1:S, which is not EQ
  to P2:S, then (UNINTERN 'P2:S :P1) should not remove
  P1:S from P1.

NEWS
src/code/target-package.lisp
tests/packages.impure.lisp
tests/with-compilation-unit.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 738319c..b3bb6e3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ changes relative to sbcl-1.0.45:
     mistake. (lp#667297).
   * bug fix: CONSTANTLY generated functions had bogus lambda-lists. (lp#713626)
   * bug fix: RUN-PROGRAM :PTY option was racy on OpenBSD. (lp#669485)
+  * bug fix: UNINTERN takes a symbol, not a symbol designator -- could previously
+    unintern the wrong symbol with the same name. (lp#693796)
 
 changes in sbcl-1.0.45 relative to sbcl-1.0.44:
   * enhancement: ~/ and ~user/ are treated specially in pathnames.
index ccaa5bb..7efbdff 100644 (file)
@@ -967,8 +967,8 @@ uninterned."
                 (remove symbol shadowing-symbols)))
 
         (multiple-value-bind (s w) (find-symbol name package)
-          (declare (ignore s))
-          (cond ((or (eq w :internal) (eq w :external))
+          (cond ((not (eq symbol s)) nil)
+                ((or (eq w :internal) (eq w :external))
                  (nuke-symbol (if (eq w :internal)
                                   (package-internal-symbols package)
                                   (package-external-symbols package))
index db5c3b2..3b5273e 100644 (file)
@@ -272,6 +272,11 @@ if a restart was invoked."
       (is (eq (sym "FOO" "SYM")
               (sym "BAZ" "SYM"))))))
 
+(with-test (:name unintern.2)
+  (with-packages (("FOO" (:intern "SYM")))
+    (unintern :sym "FOO")
+    (assert (find-symbol "SYM" "FOO"))))
+
 ;;; WITH-PACKAGE-ITERATOR error signalling had problems
 (with-test (:name with-package-itarator.error)
   (assert (eq :good
index 1239f67..1a964a9 100644 (file)
     (write `(defun bar () (typep 1 ',(intern "A-TYPE"))) :stream stream))
 
   (test-files (lambda ()
-                (unintern 'a-type)
+                (unintern (find-symbol "A-TYPE"))
                 (fmakunbound 'bar))))
 
 (delete-file *file-a*)
index 182bfd6..42be45e 100644 (file)
@@ -20,4 +20,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.45.25"
+"1.0.45.26"