On 08/06/10 22:42, Dustin J. Mitchell wrote: > My understanding is that tar should keep running until it gets EOF on > its input - that there's no explicit indication within a tarfile that > would cause tar to exit normally without reading to EOF.
That's incorrect. A tar file ends with two blocks full of zeros; tar doesn't need to keep reading after that. This is documented, for example, in the POSIX standard for tar format <http://www.opengroup.org/onlinepubs/9699919799/utilities/pax.html>. > A bit of > experimentation with /dev/zero on my own systems lends credence to > this understanding, but of course does not prove it: > (tar -cf - ChangeLog; cat /dev/zero) | tar -tf - > ChangeLog > (this hangs forever here, and truss or strace shows tar reading a lot > of 0's without any _exit(0) action..) You must be using Solaris /bin/tar for that. I believe it reads past the two zero blocks. GNU tar doesn't do that. On my Solaris 10 host: $ cd /etc $ (/usr/sfw/bin/gtar -cf - passwd; cat /dev/zero) | /usr/sfw/bin/gtar -tf - passwd $ /usr/sfw/bin/gtar --version | head -1 tar (GNU tar) 1.23 Notice that /bin/tar, even though it reads past the zero blocks, doesn't do anything useful after that: $ cd /etc $ (/bin/tar -cf - passwd; /bin/tar -cf - motd) | /bin/tar -tf - passwd so arguably GNU tar's behavior is more useful. Anyway, Amanda shouldn't rely on either behavior, obviously, if it wants to be portable.
