home *** CD-ROM | disk | FTP | other *** search
- From: mwm@cuuxb.att.com (Marc W. Mengel)
-
- In article <8276@ut-sally.UUCP> ka@hropus.UUCP (Kenneth Almquist) writes:
- :Several people have suggested that tar's method of handling links is
- :better than cpio's. After looking at the tar format, I wondered how
- :tar could possibly handle links correctly. A quick experiment showed
- :that it doesn't. Try the following:
- :
- : > file1
- : ln file1 file2
- : tar -cf archive file1 file2
- : rm file1 file2
- : tar -xf archive file2
- :
- :The second tar command will fail because tar will simply try to create
- :a link from file1 to file2, but since I only requested that file2 be
- :extracted file1 does not exist.
- :
- :I claim that this is a bug in the tar archive format rather than just
- :the tar program. Consider what tar must do to function correctly. Tar
- :could remember the location of file1 and lseek to it in this particular
- :example, but in general the input to tar is not a regular file and thus
- :may not be seekable.
- : Kenneth Almquist
-
- Actually this is easily solved using the current format, you need merely
- ensure that when a file has multiple links, that the file's data is put
- on the archive only the last time that it is referenced. This guarantees
- that the location of file1 in your example is always further along the
- archive than file2, and therefore no "rewinding" is ever needed to find
- the file after discovering that a link to it has been requested. This
- does require the program to make two traversals over the directory tree
- ( 1 to determine where the last reference to each file in the subtree
- occurs, 1 to actually write out the files), but the format itself is *not*
- inherently broken.
-
- --
- Marc Mengel
- ...!{moss|lll-crg|mtune|ihnp4}!cuuxb!mwm
-
- Volume-Number: Volume 11, Number 78
-
-