read error during LOAD cannot be printed with :escape nil

Bug #1396391 reported by James Kalenius
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

Have a file containing a read error - say, just "stumpwm:read-command". Load it and catch the error, e.g. with

(handler-case (load file) (error (c) c))

and print the result with :escape nil (this was located via princ). I get this error:

#<SB-SYS:FD-STREAM for "file /home/aeshtaer/test.lisp" {100658C8A3}> is closed
   [Condition of type SB-INT:CLOSED-STREAM-ERROR]

Backtrace:
  0: (SB-KERNEL:CLOSED-FLAME #<SB-SYS:FD-STREAM for "file /home/aeshtaer/test.lisp" {100658C8A3}>)
  1: (SB-KERNEL::STREAM-ERROR-POSITION-INFO #<SB-SYS:FD-STREAM for "file /home/aeshtaer/test.lisp" {100658C8A3}> NIL)
  2: ((FLET #:WITH-PRETTY-STREAM837 :IN SB-KERNEL::%REPORT-READER-ERROR) #<SB-PRETTY:PRETTY-STREAM {1006590C13}>)
  3: (SB-KERNEL::%REPORT-READER-ERROR #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {100658F4A3}> #<SB-PRETTY:PRETTY-STREAM {1006590C13}> :SIMPLE T :POSITION NIL)
  4: ((LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL:OUTPUT-OBJECT) #<SB-PRETTY:PRETTY-STREAM {1006590C13}>)
  5: (PRINC #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {100658F4A3}> #<SB-PRETTY:PRETTY-STREAM {1006590C13}>)
  6: (SB-FORMAT::A-FORMAT-DIRECTIVE-INTERPRETER #<SB-PRETTY:PRETTY-STREAM {1006590C13}> #<~A> (#<~ ..)
  7: (SB-FORMAT::INTERPRET-DIRECTIVE-LIST #<SB-PRETTY:PRETTY-STREAM {1006590C13}> (#<~A> #<~ ..)
  8: ((LABELS #:BODY-NAME-1234 :IN SB-FORMAT::INTERPRET-FORMAT-LOGICAL-BLOCK))
  9: (SB-FORMAT::INTERPRET-FORMAT-LOGICAL-BLOCK #<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}> (READ COMPILE-FILE #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {100658F4A3}> NIL) (READ..
 10: (SB-FORMAT::<-FORMAT-DIRECTIVE-INTERPRETER #<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}> #<~@<> (#<~S> " error during " #<~S> ":" #<~ ..)
 11: (SB-FORMAT::INTERPRET-DIRECTIVE-LIST #<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}> (#<~@<> #<~S> " error during " #<~S> ":" #<~ ..)
 12: (SB-FORMAT::%FORMAT #<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}> "~@<~S error during ~S:~ ..)
 13: (FORMAT #<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}> "~@<~S error during ~S:~ ..)
 14: ((LABELS SB-IMPL::HANDLE-IT :IN SB-KERNEL:OUTPUT-OBJECT) #<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}>)
 15: ((LAMBDA ()))
 16: (SB-INT:SIMPLE-EVAL-IN-LEXENV (HANDLER-CASE (LOAD "~/test.lisp") (ERROR (C) (WRITE C :ESCAPE NIL))) #<NULL-LEXENV>)
 17: (EVAL (HANDLER-CASE (LOAD "~/test.lisp") (ERROR (C) (WRITE C :ESCAPE NIL))))
 18: (SWANK::EVAL-REGION "(handler-case (load \"~/test.lisp\") ..)
 19: ((LAMBDA NIL :IN SWANK-REPL::REPL-EVAL))
 20: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE # {1006523BBB}>)
 21: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<CLOSURE # {1006523AFB}>)
 22: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE # {1006523ADB}>)
 23: (SWANK-REPL::REPL-EVAL "(handler-case (load \"~/test.lisp\") ..)
 24: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(handler-case (load \"~/test.lisp\") ..)
 25: (EVAL (SWANK-REPL:LISTENER-EVAL "(handler-case (load \"~/test.lisp\") ..)
 26: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(handler-case (load \"~/test.lisp\") ..)
 27: (SWANK::PROCESS-REQUESTS NIL)
 28: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 29: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 30: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE # {1003F280EB}>)
 31: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/aeshtaer/quicklisp/dists/quicklisp/software/slime-2.10.1/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE # {1003F280EB}>)
 32: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #1=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1003F02993}>) (*STANDARD-INPUT* . #2=#<SWANK/GRAY::SLIME-INPUT-STREAM {1002A98023}>) (*TRACE-OUTPUT* . #1#) (*ERR..
 33: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {10032CCE03}> NIL)
 34: ((FLET #:WITHOUT-INTERRUPTS-BODY-1117 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 35: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 36: ((FLET #:WITHOUT-INTERRUPTS-BODY-537 :IN SB-THREAD::CALL-WITH-MUTEX))
 37: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE # {7FFFF4726C2B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "repl-thread" RUNNING {1003F20083}>> NIL T NIL)
 38: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {1003F20083}> #S(SB-THREAD:SEMAPHORE :NAME "Thread setup semaphore" :%COUNT 0 :WAITCOUNT 0 :MUTEX #<SB-THREAD:MU..
 39: ("foreign function: call_into_lisp")
 40: ("foreign function: new_thread_trampoline")

What I expected: the error message to be printed. e.g. the same setup in CCL outputs «There is no package named "STUMPWM" .».

This does not happen with compile-file instead of load, or with :escape t.

I previosuly reported #1042610, which also involves SB-C::INPUT-ERROR-IN-COMPILE-FILE and a hairly loading situation. MIght be related.

sbcl --version
SBCL 1.1.14.debian

uname -a
Linux Sri3 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

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

Revision history for this message
James Kalenius (aeshtaer) wrote :

As it says in the backtrace, I think the sort of problem is that sb-kernel::stream-error-position-info calls stream-element-type on a closed stream. The whole function would probably fail on it, though.

Revision history for this message
Douglas Katzman (dougk) wrote :

update to latest code.
Fixed here:

commit 78e77e3cadb6501263fe09b02da8b71e963da38e
Author: Jan Moringen <email address hidden>
Date: Mon Dec 30 01:33:50 2013 +0100

    STREAM-ERROR-POSITION-INFO signals errors in fewer situations

    Previously, STREAM-ERROR-POSITION-INFO could signal errors for
    non-character streams and closed streams.

    Fixes lp1264902.

Revision history for this message
James Kalenius (aeshtaer) wrote :

Thanks

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.