Skip to content

Commit

Permalink
0.8.4.21:
Browse files Browse the repository at this point in the history
	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
  • Loading branch information
csrhodes committed Oct 13, 2003
1 parent 8db1459 commit c6b35dc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/code/fd-stream.lisp
Expand Up @@ -1225,7 +1225,7 @@
(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)))))))))
Expand Down
13 changes: 10 additions & 3 deletions src/code/filesys.lisp
Expand Up @@ -829,9 +829,16 @@
(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
Expand Down
10 changes: 10 additions & 0 deletions tests/stream.impure.lisp
Expand Up @@ -66,5 +66,15 @@
(assert (= (read-byte s) -1)))
(delete-file p))

;;; :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))

;;; success
(quit :unix-status 104)
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -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"

0 comments on commit c6b35dc

Please sign in to comment.