I'm working on a program that among other things wants to test a tarfile. I am doing this by running 'tar tf archive.tar' and checking the exit status.
I have found that sometimes tar will exit with a 0 status for files that are not tarfiles. I'm not sure if this is a bug or occurs because some simple files are actually degenerate cases of the tar format. I found this phenomenon on tar 1.14 (RHEL 4), but I've also verified it with a freshly-built 1.18 version. $ ./src/tar --version tar (GNU tar) 1.18 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. $ ./src/tar tf /etc/passwd ./src/tar: This does not look like a tar archive ./src/tar: Skipping to next header ./src/tar: Error exit delayed from previous errors $ echo $? 2 $ rm -f foo $ echo FOO > foo $ ./src/tar tf foo $ echo $? 0 I'm not subscribed to the list, just wanted to send a quick report, so please cc me on replies. Thanks, Ian
