'open :if-exists nil' not working on windows

Bug #1674437 reported by Jan Idzikowski on 2017-03-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

sbcl under ms-windows:

:if-exists nil with open should return nil if file exists, ansi common lisp:
"No file or stream is created; instead, nil is returned to indicate failure."

but sbcl under windows throw error:

error opening #P"k:/work/myfile.txt": Die Datei ist vorhanden.
   [Condition of type SB-INT:SIMPLE-FILE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {267C8E51}>)

Backtrace:
  0: ((FLET SB-IMPL::VANILLA-OPEN-ERROR :IN OPEN))
  1: ((LAMBDA ()))
  2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (WITH-OPEN-FILE (S "k:/work/myfile.txt" :DIRECTION :OUTPUT :IF-DOES-NOT-EXIST :CREATE ...) (FORCE-OUTPUT S) (WRITE-STRING STR S)) #<NULL-LEXENV>)
  3: (EVAL (WITH-OPEN-FILE (S "k:/work/myfile.txt" :DIRECTION :OUTPUT :IF-DOES-NOT-EXIST :CREATE ...) (FORCE-OUTPUT S) (WRITE-STRING STR S)))
 --more--

Test:

(with-open-file (s "k:/work/myfile.txt"
                       :direction :output
                       :if-does-not-exist :create
                       :if-exists nil
                       :external-format :utf-8))

sbcl: 1.3.12 MS Windows 7 Professional

Jan Idzikowski (itze) on 2017-03-20
description: updated
Stas Boukarev (stassats) wrote :

In 202e00628820daf9a6d141daea222273cb252f6d

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

Other bug subscribers