How to archive several files with tar?

Jonathan I. Kamens jik at cats.ucsc.edu
Tue Jun 18 07:20:10 AEST 1991


In article <2742 at root44.co.uk>, gwc at root.co.uk (Geoff Clare) writes:
|> In article <2740 at root44.co.uk>, I wrote:
|> > Any decent version of tar will warn you if an input file changes in size.
|> 
|> In <16978 at darkstar.ucsc.edu> jik at cats.ucsc.edu (Jonathan I. Kamens) writes:
|> 
|> >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.
|> 
|> Jonathan has completely missed my main point and picked up on an aside.

No, I got your main point.  But you missed mine, which I guess makes us even.

|> It is not "version checking" that stops tar from filling the disk, it is
|> the fundamental fact that the tar output format contains each archived
|> file's size before its contents.  Once tar has written out the size of
|> the file in a header block, it must write exactly that many bytes of data
|> as the file's contents, even if the file changes size.  Otherwise the
|> output tar archive will be corrupt and unusable.

A GOOD VERSION OF TAR will check the amount of bytes it has written, and stop
when it has reached the number of bytes recorded in the header preceding the
file.  My point in my last two postings in this thread is that there are BAD
VERSIONS OF TAR that don't do that.  They stat the file, record its size in
the tar file, and then open the file and read it until EOF and write its
contents into the tar file.

|> >I was talking about the "worst case," i.e. a poor version of tar.
|> 
|> I claim categorically that such a tar is broken.

Yes, of course it's broken.  I never claimed otherwise.  My point in my
previous two postings, and in this one, is that SUCH BROKEN VERSIONS EXIST,
and that, therefore, the worse thing that can happen to you if you try to add
a tar archive to itself is that the file will grow until it can't grow any
further.

Got it?

-- 
Jonathan Kamens					jik at CATS.UCSC.EDU



More information about the Comp.unix.questions mailing list