0.8.4.21:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 13 Oct 2003 11:57:54 +0000 (11:57 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 13 Oct 2003 11:57:54 +0000 (11:57 +0000)
A couple of filesystem-related fixes from Milan Zamazal
... :IF-EXISTS OPEN behaviour corrected
... don't error if a file is deleted from under us in DIRECTORY

NEWS
src/code/fd-stream.lisp
src/code/filesys.lisp
tests/stream.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index eea0087..f5654b9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2122,6 +2122,8 @@ changes in sbcl-0.8.5 relative to sbcl-0.8.4:
   * bug fix: obviously wrong type specifiers such as (FIXNUM 1) or
     (CHARACTER 10) are now reported as errors, rather than propagated
     as unknown types.  (reported by piso on #lisp)
+  * bug fix: the :IF-EXISTS argument to OPEN now behaves correctly
+    with values NIL and :ERROR.  (thanks to Milan Zamazal)
   * compiler enhancement: SIGNUM is now better able to derive the type
     of its result.
   * fixed some bugs revealed by Paul Dietz' test suite:
index ce07516..b403ffa 100644 (file)
                      (open-error "~@<The path ~2I~_~S ~I~_does not exist.~:>"
                                  pathname))
                     (t nil)))
-                 ((and (eql errno sb!unix:eexist) if-exists)
+                 ((and (eql errno sb!unix:eexist) (null if-exists))
                   nil)
                  (t
                   (vanilla-open-error)))))))))
index 46e9e85..32a48ef 100644 (file)
         (merged-pathname (merge-pathnames pathname)))
     (!enumerate-matches (match merged-pathname)
       (let* ((*ignore-wildcards* t)
-            (truename (truename match)))
-        (setf (gethash (namestring truename) truenames)
-             truename)))
+            ;; FIXME: Why not TRUENAME?  As reported by Milan Zamazal
+            ;; sbcl-devel 2003-10-05, using TRUENAME causes a race
+            ;; condition whereby removal of a file during the
+            ;; directory operation causes an error.  It's not clear
+            ;; what the right thing to do is, though.  -- CSR,
+            ;; 2003-10-13
+            (truename (probe-file match)))
+       (when truename
+         (setf (gethash (namestring truename) truenames)
+               truename))))
     (mapcar #'cdr
            ;; Sorting isn't required by the ANSI spec, but sorting
            ;; into some canonical order seems good just on the
index d3f3adf..8b5649d 100644 (file)
     (assert (= (read-byte s) -1)))
   (delete-file p))
 \f
+;;; :IF-EXISTS got :ERROR and NIL the wrong way round (reported by
+;;; Milan Zamazal)
+(let* ((p "this-file-will-exist")
+       (stream (open p :direction :output :if-exists :error)))
+  (assert (null (with-open-file (s p :direction :output :if-exists nil) s)))
+  (assert (raises-error?
+          (with-open-file (s p :direction :output :if-exists :error))))
+  (close stream)
+  (delete-file p))
+\f
 ;;; success
 (quit :unix-status 104)
index 9743a13..6e2765f 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.4.20"
+"0.8.4.21"