Using ZipArchive with thousands of files

Ned Konz ned at bike-nomad.com
Thu Jul 10 16:01:14 UTC 2003


On Thursday 10 July 2003 06:51 am, Giovanni Corriga wrote:
> Hi.
>
> I'm using Squeak 3.5 with a clean image on a Linux workstation. I
> am trying to use ZipArchive to zip a directory containing >1200
> text files. The problem is that if I do something like
>
> dir fileNames do: [:name | archive addFile: name]
>
> the system runs out of file descriptors, and can't continue adding
> files.
> Is there a way to avoid this within Squeak?

Yes. The author of ZipNewFileMember was being stupid, as he often 
seems to be.

There's no reason that it should hold on to the stream, especially 
since it doesn't use the stream until it actually writes the file.

I'll fix that.

One question, though: what should happen if the file should change 
between being added to the zip and the zip being written? That is, 
how paranoid do we need to be about checking for changes?

Right now, the file size is gotten right before we start to compress 
the data when writing the zip. Clearly, we don't need to do this; we 
can tell when the read stream stops easily enough!

Since we re-write the local file header after compressing the data 
anyway (assuming that we can seek backwards in the output stream), we 
could just freshen the directory information at the end of write.

I'll see what I can do.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list