Read error in file LOADed in EVAL-WHEN causes failed AVER

Bug #1042610 reported by James Kalenius
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

The following setup causes an error.

failer.lisp is some file that causes a read error - for example it only contains an open parenthesis.

trash.lisp is set up to load failer.lisp at compile and load times, e.g. it might contain:

(eval-when (:compile-toplevel :load-toplevel) (load "failer.lisp"))

Compiling foo.lisp results in the following error:

     failed AVER: (NULL CURRENT)
   This is probably a bug in SBCL itself. (Alternatively, SBCL might have
   been corrupted by bad user code, e.g. by an undefined Lisp operation
   like (FMAKUNBOUND 'COMPILE), or by stray pointers from alien code or
   from unsafe Lisp code; or there might be a bug in the OS or hardware
   that SBCL is running on.) If it seems to be a bug in SBCL itself, the
   maintainers would like to know about it. Bug reports are welcome on the
   SBCL mailing lists, which you can find at
   <http://sbcl.sourceforge.net/>.

Backtrace:
  0: (SB-C:COMPILER-ERROR SB-C::INPUT-ERROR-IN-COMPILE-FILE :CONDITION #<END-OF-FILE {B5DB2E1}> :POSITION 0 :STREAM #<SB-SYS:FD-STREAM for "file /home/aeshtaer/failer.lisp" {B5D8C49}>)
  1: (SB-C::READ-FOR-COMPILE-FILE #<SB-SYS:FD-STREAM for "file /home/aeshtaer/failer.lisp" {B5D8C49}> 0)
  2: (SB-INT:LOAD-AS-SOURCE #<SB-SYS:FD-STREAM for "file /home/aeshtaer/failer.lisp" {B5D8C49}> :VERBOSE NIL :PRINT NIL :CONTEXT "loading")
  3: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-SYS:FD-STREAM for "file /home/aeshtaer/failer.lisp" {B5D8C49}> NIL)
  4: (LOAD "/home/aeshtaer/failer.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
  5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LOAD "/home/aeshtaer/failer.lisp") #<NULL-LEXENV>)
  6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (PROGN (LOAD "/home/aeshtaer/failer.lisp")) #<NULL-LEXENV>)
  7: (EVAL-TLF (PROGN (LOAD "/home/aeshtaer/failer.lisp")) 0 #<NULL-LEXENV>)
  8: (SB-C::EVAL-COMPILE-TOPLEVEL ((LOAD "/home/aeshtaer/failer.lisp")) (SB-C::ORIGINAL-SOURCE-START 2 2 0))
  9: ((FLET SB-C::DEFAULT-PROCESSOR :IN SB-C::PROCESS-TOPLEVEL-FORM) (LOAD "/home/aeshtaer/failer.lisp"))
 10: (SB-C::PROCESS-TOPLEVEL-FORM (LOAD "/home/aeshtaer/failer.lisp") (SB-C::ORIGINAL-SOURCE-START 0 0) (:COMPILE-TOPLEVEL))
 11: (SB-C::PROCESS-TOPLEVEL-PROGN ((LOAD "/home/aeshtaer/failer.lisp")) (SB-C::ORIGINAL-SOURCE-START 0 0) (:COMPILE-TOPLEVEL))
 12: (SB-C::PROCESS-TOPLEVEL-FORM (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL) (LOAD "/home/aeshtaer/failer.lisp")) (SB-C::ORIGINAL-SOURCE-START 0 0) NIL)
 13: (SB-C::SUB-SUB-COMPILE-FILE #<SB-C::SOURCE-INFO >)
 14: ((LAMBDA () :IN SB-C::SUB-COMPILE-FILE))
 15: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
 16: (SB-C::SUB-COMPILE-FILE #<SB-C::SOURCE-INFO >)
 17: (COMPILE-FILE "~/trash.lisp" :OUTPUT-FILE NIL :VERBOSE NIL :PRINT NIL :EXTERNAL-FORMAT :DEFAULT :TRACE-FILE NIL :BLOCK-COMPILE NIL :EMIT-CFASL NIL)
 18: (SB-INT:SIMPLE-EVAL-IN-LEXENV (COMPILE-FILE "~/trash.lisp") #<NULL-LEXENV>)
 19: (EVAL (COMPILE-FILE "~/trash.lisp"))

Behavior is as expected on ABCL and CCL, that is, a read error is reported. If :load-toplevel is omitted, it works (the file is compiled but the read error is reported, and loading the fasl signals an error). If :compile-toplevel is omitted, it works (nothing happens at compile time, and loading the fasl signals an error).

Sorry for the weird test case, but I wasn't sure how to reduce this any further. I ran into this by compiling a file that tried to quickload iolib in an eval-when (bad idea, I know) - iolib.base.asd relies on *compile-file-pathname* or *load-truename* being bound appropriately at read time.

sbcl --version
SBCL 1.0.57.66-5783625

uname -a
Linux Sri2 3.0.0-0300-generic #201107220917 SMP Fri Jul 22 10:10:37 UTC 2011 i686 i686 i386 GNU/Linux

*features*
(:QUICKLISP :SB-BSD-SOCKETS-ADDRINFO :ASDF2 :ASDF :ASDF-UNICODE :ANSI-CL
 :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS :SB-UNICODE
 :SB-EVAL :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT :OS-PROVIDES-POLL
 :OS-PROVIDES-GETPROTOBY-R :OS-PROVIDES-SUSECONDS-T :OS-PROVIDES-BLKSIZE-T
 :OS-PROVIDES-PUTWC :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :LITTLE-ENDIAN
 :LINKAGE-TABLE :MULTIPLY-HIGH-VOPS :MEMORY-BARRIER-VOPS :INLINE-CONSTANTS
 :CYCLE-COUNTER :ALIEN-CALLBACKS :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-ALLOCATABLE-CLOSURES :RAW-INSTANCE-INIT-VOPS
 :UNWIND-TO-FRAME-AND-CALL-VOP :COMPARE-AND-SWAP-VOPS :C-STACK-IS-CONTROL-STACK
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :GENCGC :LARGEFILE :SB-FUTEX :SB-THREAD
 :LINUX :ELF :UNIX :X86)

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Incomplete
status: Incomplete → Triaged
importance: Undecided → Medium
Revision history for this message
Stas Boukarev (stassats) wrote :

36ac54616a084c16d34afd03af3efb51b096b729

Changed in sbcl:
status: Triaged → Fix Released
status: Fix Released → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.