home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.11 / text0077.txt < prev    next >
Encoding:
Internet Message Format  |  1987-07-18  |  1.7 KB

  1. From: mwm@cuuxb.att.com (Marc W. Mengel)
  2.  
  3. In article <8276@ut-sally.UUCP> ka@hropus.UUCP (Kenneth Almquist) writes:
  4. :Several people have suggested that tar's method of handling links is
  5. :better than cpio's.  After looking at the tar format, I wondered how
  6. :tar could possibly handle links correctly.   A quick experiment showed
  7. :that it doesn't.  Try the following:
  8. :
  9. :    > file1
  10. :    ln file1 file2
  11. :    tar -cf archive file1 file2
  12. :    rm file1 file2
  13. :    tar -xf archive file2
  14. :
  15. :The second tar command will fail because tar will simply try to create
  16. :a link from file1 to file2, but since I only requested that file2 be
  17. :extracted file1 does not exist.
  18. :
  19. :I claim that this is a bug in the tar archive format rather than just
  20. :the tar program.  Consider what tar must do to function correctly.  Tar
  21. :could remember the location of file1 and lseek to it in this particular
  22. :example, but in general the input to tar is not a regular file and thus
  23. :may not be seekable.  
  24. :                Kenneth Almquist
  25.  
  26. Actually this is easily solved using the current format, you need merely
  27. ensure that when a file has multiple links, that the file's data is put
  28. on the archive only the last time that it is referenced.  This guarantees
  29. that the location of file1 in your example is always further along the
  30. archive than file2, and therefore no "rewinding" is ever needed to find 
  31. the file after discovering that a link to it has been requested.  This 
  32. does require the program to make two traversals over the directory tree 
  33. ( 1 to determine where the last reference to each file in the subtree 
  34. occurs, 1 to actually write out the files), but the format itself is *not*
  35. inherently broken.
  36.  
  37. -- 
  38.  Marc Mengel
  39.  ...!{moss|lll-crg|mtune|ihnp4}!cuuxb!mwm
  40.  
  41. Volume-Number: Volume 11, Number 78
  42.  
  43.