Strange behavior around unbinding specials, or something
I had trouble coming up with a good title for this bug report, as the behavior is very odd. I ran into it while trying to get FSet to pass its test suite on ECL. I tried the last three ECL releases (24.5.10, 23.9.9, and 21.2.1); all of them have the bug. I'm on Linux x86_64; I build with configure --prefix=/usr/local; make -j16
.
Start by loading FSet:
(ql:quickload "fset")
then compile the function below. This is a greatly boiled-down version of fset::test-misc
.
(in-package :fset)
(defun foo ()
"Tests some things that don't need extensive random test cases generated."
(macrolet ((test (form)
`(unless ,form
(error "Test failed: ~S" ',form))))
(flet ((equal? (a b)
(and (equal? a b)
(equal? b a))))
(with-standard-io-syntax
(let ((*package* (find-package :fset))
(*readtable* *fset-readtable*)
(*print-readably* nil))
(test (equal? (prin1-to-string (bag 1 1)) "#{% (1 2) %}"))))
(test (= (size (seq 1 2 3)) 3)))))
Now, in the REPL:
CL-USER> (in-package :fset)
#<"FSET" package>
FSET> *print-readably*
NIL
FSET> (foo)
NIL
;;; note the change in *package*
CL-USER> *print-readably*
;;; this changed too
T
CL-USER>
Deleting either of the calls to test
makes the bug disappear.
It is as if the bindings of *package*
and *print-readably*
created by with-standard-io-syntax
are not popped. That's why I speculate that it has to do with unbinding specials.
Provide details regarding ECL version (or preferably commit), operating system and if revelant the build options and versions of the build tools.
VERSION "21.2.1"
VCS-ID "UNKNOWN"
OS "Linux"
OS-VERSION "5.14.21-150500.55.52-default"
MACHINE-TYPE "x86_64-linux"
FEATURES (:FSET-EXT-STRINGS :NAMED-READTABLES :SWANK :SERVE-EVENT :QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :WALKER :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :COMPLEX-FLOAT :LONG-FLOAT :UNICODE :DFFI :CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS :BOEHM-GC :ANSI-CL :COMMON-LISP :FLOATING-POINT-EXCEPTIONS :IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14 :PREFIXED-API :FFI :X86_64 :COMMON :ECL)