Opened 4 years ago

Last modified 2 years ago

#1306 new defect

with-open-file supersede sometimes fails on Windows

Reported by: nandryshak Owned by:
Priority: normal Milestone:
Component: other Version: 1.10
Keywords: Cc:

Description

CCL Version: Version 1.10-r16196 (WindowsX8632) Windows 7 64-bit

Intermittently (I know, I know, I'm sorry), WITH-OPEN-FILE fails when superseding a file. Something strange occurs in the error message:

[2015-08-25 16:18:40 [ERROR]] File exists : #P"C:/path/to/output/example-markdown.html"
 (3AF99E0) : 0 (PRINT-CALL-HISTORY :CONTEXT NIL :PROCESS NIL :ORIGIN NIL :DETAILED-P NIL :COUNT 536870911 :START-FRAME-NUMBER 0 :STREAM #<STRING-OUTPUT-STREAM  #x1920F0C6> :PRINT-LEVEL 2 :PRINT-LENGTH 5 :SHOW-INTERNAL-FRAMES NIL :FORMAT :TRADITIONAL) 727
 (3AF9A94) : 1 (PRINT-BACKTRACE-TO-STREAM #<STRING-OUTPUT-STREAM  #x1920F0C6>) 71
 (3AF9AAC) : 2 (GET-BACKTRACE) 311
 (3AF9AE0) : 3 (FUNCALL #'#<(:INTERNAL (HUNCHENTOOT:HANDLE-REQUEST (HUNCHENTOOT:ACCEPTOR HUNCHENTOOT:REQUEST)))> #<CCL::SIMPLE-FILE-ERROR #x1920F0DE>) 95
 (3AF9AF8) : 4 (SIGNAL #<CCL::SIMPLE-FILE-ERROR #x1920F0DE>) 871
 (3AF9B20) : 5 (%ERROR #<CCL::SIMPLE-FILE-ERROR #x1920F0DE> NIL 15460045) 111
 (3AF9B34) : 6 (%CREATE-FILE #P"C:/path/to/output/example-markdown.html" :IF-EXISTS :ERROR :CREATE-DIRECTORY T) 447
 (3AF9B58) : 7 (MAKE-FILE-STREAM "output/example-markdown.html" :OUTPUT BASE-CHAR :SUPERSEDE :CREATE FILE-STREAM :DEFAULT :PRIVATE T) 1047
 (3AF9BA4) : 8 (OPEN "output/example-markdown.html" :DIRECTION :OUTPUT :ELEMENT-TYPE BASE-CHAR :IF-EXISTS :SUPERSEDE :IF-DOES-NOT-EXIST :CREATE :EXTERNAL-FORMAT :DEFAULT :CLASS FILE-STREAM :SHARING :PRIVATE :BASIC T) 727

You can see in the call to OPEN, :IF-EXISTS is set to :SUPERSEDE. However, once it gets to %CREATE-FILE, :IF-EXISTS is set to :ERROR.

Here's the code:

(with-open-file (stream (concatenate 'string *output-directory* filename)
                        :direction :output
                        :if-exists :supersede
                        :if-does-not-exist :create)
  (write-string
   (who:with-html-output-to-string (s)
     (format-markdown s markdown))
   stream))


I cannot reliably reproduce this.

Nick

Change History (1)

comment:1 Changed 2 years ago by rme

  • Milestone Clozure CL 1.10 deleted

Milestone Clozure CL 1.10 deleted

Note: See TracTickets for help on using tickets.