Character input streams not recognized as such

Bug #1990490 reported by Artyom Bologov
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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, 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:

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