Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
If a non-local exit occurs during WITH-OPEN-FILE
body, the system either tries to restore the file to it's original
contents or deletes it if it can't -- for fd-streams at least.
"When control leaves the body, either normally or abnormally (such as by
use of throw), the file is automatically closed. If a new output file is
being written, and control leaves abnormally, the file is aborted and the
file system is left, so far as possible, as if the file had never been
So the current behaviour is ok for newly created files, but
deeply wrong if the file already existed and was opened with
Actually, the bug is with CLOSE. My bad.
From CLHS on CLOSE:
"If abort is true, an attempt is made to clean up any side effects of
having created stream. If stream performs output to a file that was
created when the stream was created, the file is deleted and any
previously existing file is not superseded."
So CLOSE should not delete appending streams with :abort.
Replying to one's own post is pathetic enough, so doing it twice is a row
must be downright hopeless.
Anyways, the attached patch fixes the reported bug and adds a few
test-cases. The mechanism employed is slightly kludgy, but at least
Since this particular bug involves potential file-lossage I sort of
assumed that fixing it quickly would be more important then grace...