Character input streams not recognized as such

Bug #1990490 reported by Artyom Bologov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
Undecided
Unassigned

Bug Description

When I try to write a string (using either `write', `prin1', or `print') to an empty existing text file open with `open', it errors out that the stream is not a character one (full backtrace from SLY in the attachment):

#<SB-SYS:FD-STREAM for "file /home/aartaka/junkyard/empty.lisp" {1003DDFC83}> is not a character output stream.
   [Condition of type SIMPLE-TYPE-ERROR]

The error happens both in SLY REPL in Emacs and in barebones SBCL in the shell.

The test case for it is (change the name of the file and location to e.g. /tmp/empty.lisp if necessary):

(with-open-file (s #p"~/junkyard/empty.lisp" :if-exists :supersede
                                             :if-does-not-exist :create)
  (print '(hello) s))

sbcl --version reports "SBCL 2.2.6". I've tried rebuilding from source on version 2.2.8.130-bf54ddf64, and on 2.2.4. The bug seems to persist.

uname -a reports "Linux paranoidal 5.18.10 #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux"

*features* are:
(:QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :X86-64 :GENCGC :64-BIT :ANSI-CL
 :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN
 :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS
 :SB-THREAD :SB-UNICODE :SBCL :UNIX)

Might be related to bug #1956878, but I've decided to report separately just in case it's not.

Revision history for this message
Artyom Bologov (aartaka) wrote :
Revision history for this message
Stas Boukarev (stassats) wrote :

It's not lying, it's an input stream. Add :direction :output. (Alternatively, :io)

Changed in sbcl:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers