How to archive several files with tar?

Jonathan I. Kamens jik at cats.ucsc.edu
Thu Jun 13 07:22:00 AEST 1991


In article <2740 at root44.co.uk>, gwc at root.co.uk (Geoff Clare) writes:
|> In <16873 at darkstar.ucsc.edu> jik at cats.ucsc.edu (Jonathan I. Kamens) writes:
|> >In article <ADRIANHO.91Jun9105223 at barkley.berkeley.edu>, adrianho at barkley.berkeley.edu (Adrian J Ho) writes:
|> >|> In the worst case, it could be the _last_ file included, which means
|> >|> that your tar file could end up being _twice_ as large as it's
|> >|> supposed to be.
|> 
|> >  Actually, the worst case is that the tar file will continue to grow as tar
|> >writes into it, so that when tar opens that file to archive it, the file will
|> >grow as tar is archiving it, which means that there will be more to archive,
|> >etc., etc. until the disk fills up or the user exceeds his quota or the
|> >maximum file size or whatever.
|> 
|> Actually, Jonathan is wrong and Adrian was right.

Um, no.

|> Although many utilities will fill the disk if made to read their output
|> file, this is not true of tar (unless you have a broken tar).  In the tar
|> output format the size of each file is contained in a header which
|> precedes the file's contents.  Hence the amount of data which tar will
|> read from its own output file is limited to its size when tar starts
|> reading it.  If the output file is the last input file, it will
|> approximately double in size when tar reads it.
|> 
|> Any decent version of tar will warn you if an input file changes in size.

I have *used* a version of tar which does not do proper version checking, and
which therefore creates a tar archive that fills the disk.  I would not have
mentioned it if I hadn't used it.

Now, perhaps my recollection is wrong, and I didn't actually ever use such a
tar.  But unless you're willing to make the categorical claim that such a tar
does not exist (which you appear to be unwilling to do, since you said "unless
you have a broken tar" and later "Any decent version of tar"), saying that I
am "wrong" is unwarranted.

I was talking about the "worst case," i.e. a poor version of tar.

-- 
Jonathan Kamens					jik at CATS.UCSC.EDU



More information about the Comp.unix.questions mailing list