From: Vassil Nikolov on

On Sat, 13 Mar 2010 01:45:32 +0100, pjb(a)informatimago.com (Pascal J. Bourguignon) said:

> Tim X <timx(a)nospam.dev.null> writes:
>> ...
>> This may not refute the original claim of using file size in that the
>> copied size will be equal or greater, but I think it does highlight the
>> danger of using filesize to predict anything other than the size of that
>> file at that moment in time.

> clisp doesn't create a sparse file, but a CL implementation could easily
> do so

... and some indeed do (see below); I hardly expect (to say the
least) FILE-LENGTH's value to be (based on) the "physical" size of
the file, though, rather than the "logical" size, so this issue, at
least, is not important right now, I don't think.

* (defvar *s* (open "/tmp/sparse" :direction :output))

*S*
* (write-string "foo" *s*)

"foo"
(file-position *s* 1000000)

T
* (write-string "bar" *s*)

"bar"
* (finish-output *s*)

NIL
* (file-length *s*)

1000003
* ;; (shell-command "ls -ls \"/tmp/sparse\"" '(4))[type C-x C-e here] 12 -rw-r--r-- 1 van van 1000003 Mar 12 22:56 /tmp/sparse
^^ ^^^^^^^

(By the way, I chose a name for the temporary file above _before_
reading Pascal Bourguignon's post.)

---Vassil.


--
No flies need shaving.
First  |  Prev  | 
Pages: 1 2 3 4
Prev: need easy benchmarks
Next: Lisp sucks!