From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc3) Gecko/20020523 Description of problem: The tar "--delete" option corrupts a tar archive (file) when no member name is specified, or if the given member is not in fact a member of the archive. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. create a tar archive (file) 2. verify the archive 3. attempt to use the "--delete" option but give no member names (or, give a member name that is not in the archive) 4. list the archive and see that it is corrupted Actual Results: archive is corrupted/destroyed Expected Results: archive should not be corrupted Additional info: spn@mok[21]: tar --create --file=collection.tar * spn@mok[22]: tar --list --file=collection.tar blues folk jazz practice/ practice/blues practice/folk practice/jazz practice/rock rock spn@mok[23]: tar --delete --file=collection.tar folk spn@mok[24]: tar --list --file=collection.tar blues jazz practice/ practice/blues practice/folk practice/jazz practice/rock rock spn@mok[25]: tar --delete --file=collection.tar bluez tar: bluez: Not found in archive tar: Error exit delayed from previous errors spn@mok[26]: tar --list --file=collection.tar spn@mok[27]: file collection.tar collection.tar: ASCII text, with no line terminators spn@mok[28]:
Works with tar from 7.3.
It does not work with the 7.3 machine to which I have access: spn@n[105]: rpm -q tar tar-1.13.25-4 spn@n[106]: tar cf t.tar passwd hosts spn@n[107]: tar f t.tar --list passwd hosts spn@n[108]: tar f t.tar --delete junk tar: junk: Not found in archive tar: Error exit delayed from previous errors spn@n[109]: tar ft t.tar spn@n[110]: tar f t.tar --list spn@n[111]: file t.tar t.tar: data OR: spn@n[112]: tar cf t.tar passwd hosts spn@n[113]: tar tf t.tar passwd hosts spn@n[114]: tar f t.tar --delete hosts spn@n[115]: tar tf t.tar passwd spn@n[116]: tar f t.tar --delete spn@n[117]: tar tf t.tar Note: according to a (slightly old) man/info page at gnu.org "if you list no member names, nothing will be deleted." However, the regression tests in tar-1.13.19-4 are not very sophisticated and they don't check for these conditions. Suggest re-opening or reporting somewhere.
The problem depends (apparently) on the size of the members. It's clearly a bug in tar, and I've submitted a bug report to bug-tar In the tests directory of the unpatched 7.1 source for tar, .../tar-1.13.19/tests, I performed the following (similar to what "make check" performs): # ./genfile -l 50000 > file1 # ./genfile -l 1024 > file2 # ../src/tar cf archive file1 file2 # ../src/tar f archive --delete # ../src/tar tf archive file1 file2 # ./genfile -l 25000 > file1 # ./genfile -l 1024 > file2 # ../src/tar cf archive file1 file2 # ../src/tar f archive --delete # ../src/tar tf archive file1 # ./genfile -l 1024 > file1 # ./genfile -l 1024 > file2 # ../src/tar cf archive file1 file2 # ../src/tar f archive --delete # ../src/tar tf archive #
well, according to Paul Eggert, the current maintainer of GNU tar, there are several unfixed bugs in delete. it's unfortunate that the man page, info page, and all the source documentation neglect to mention this. FYI (i meant to include this in the previous post) the same problems exist in the tar-1.13.25 distribution (on which is based the version of tar in 7.3).