Re: Why doesn't (open ... :if-exists) support :truncate?



David Lichteblau <usenet-2006@xxxxxxxxxxxxxx> writes:

SBCL's :APPEND has a similar bug. The spec says "The file pointer is
initially positioned at the end of the file", but SBCL maps it to
O_APPEND instead.

Well clearly the file pointer is supposed to be positioned to the end
of the file, but I don't see anything that says that says the
implementation is forbidden from opening the file with O_APPEND-y
semantics, only that the file is destructively modified.

(Also, if you're interested in being able to do random-access writes,
doing and starting at the end of the file, I would expect this to do
the trick on Unix file systems:

(with-open-file (stream pathname :direction :overwrite)
(file-position stream :end)
... stuff ...)

This might not work on some other file systems though. For example,
while the Unix file system ensures that when you lseek to or past the
end of a file and then do some writing, the file will automatically be
resized (possibly sparsely), I think I've read that some older file
systems required you to manually allocate space for files; anyway you
can imagine a file system like that. Maybe a CL implementation that
talked to such a file system would constrain :OVERWRITE to not resize
the file, but have :APPEND do the resizing implicitly.)

--
.



Relevant Pages

  • Re: lvm question
    ... But, the lower graphic shows hda4 on the left end, ... common sense says it should be on the right end, ... or the file system size? ... but I though you had to resize the file system after enlarging the ...
    (Fedora)
  • Re: lvm question
    ... But, the lower graphic shows hda4 on the left end, ... common sense says it should be on the right end, ... or the file system size? ... but I though you had to resize the file system after enlarging the ...
    (Fedora)
  • Re: LVM Question
    ... /work) it didn't show that the file system had been extended. ... lvextend extends the underlying block device. ... You will need to resize the file-system. ... Presuming it's an ext3 filesystem, ...
    (Fedora)
  • Re: LVM Question
    ... when I did a display on the file system (df -m ... /work) it didn't show that the file system had been extended. ... lvextend extends the underlying block device. ... You will need to resize the file-system. ...
    (Fedora)
  • Re: Larkin, Power BASIC cannot be THAT good:
    ... and have it handed to you on a tray with a ... but windows will start faster then it takes to resize a reiserfs from 830 to 600 GB: ... What sane person resizes a file system? ...
    (sci.electronics.design)