Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Update of /cvsroot/sbcl/sbcl/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25276/tests
Fixed bug in OPEN / CLOSE interaction that caused file deletion when
appending stream was closed with :ABORT T.
... BUGS entry about similar behaviour when superseding files.
... Regression test for the same.
RCS file: /cvsroot/sbcl/sbcl/tests/stream.impure.lisp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- stream.impure.lisp 5 May 2004 12:10:02 -0000 1.10
+++ stream.impure.lisp 20 May 2004 14:47:54 -0000 1.11
@@ -125,5 +125,29 @@
(assert (= 1 (file-position s))) ; unicode...
(assert (file-position s 0))))
+;;; CLOSING a non-new streams should not delete them, and superseded
+;;; files should be restored.
+(let ((test "test-file-for-close-should-not-delete"))
+ (macrolet ((test-mode (mode)
+ (catch :close-test-exit
+ (with-open-file (f test :direction :output :if-exists ,mode)
+ (write-line "test" f)
+ (throw :close-test-exit t)))
+ (assert (and (probe-file test) ,mode)))))
+ (with-open-file (f test :direction :output)
+ (write-line "test" f))
+ (test-mode :append)
+ ;; FIXME: We really should recover supersede files as well, according to
+ ;; CLOSE in CLHS, but at the moment we don't.
+ ;; (test-mode :supersede)
+ (test-mode :rename)
+ (test-mode :rename-and-delete))
+ (when (probe-file test)
+ (delete-file test)))))
(quit :unix-status 104)