Bug 66047 - tar --delete corrupts archive when given no or missing targets
tar --delete corrupts archive when given no or missing targets
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
7.1
i386 Linux
medium Severity high
: ---
: ---
Assigned To: wdovlrrw
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-06-04 18:11 EDT by Need Real Name
Modified: 2007-04-18 12:42 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-06-04 18:11:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2002-06-04 18:11:16 EDT
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]:
Comment 1 Bernhard Rosenkraenzer 2002-06-04 18:14:58 EDT
Works with tar from 7.3.
Comment 2 Need Real Name 2002-06-04 18:48:33 EDT
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.
Comment 3 Need Real Name 2002-06-05 16:39:08 EDT
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@gnu.org

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
#
Comment 4 Need Real Name 2002-06-05 16:47:45 EDT
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).

Note You need to log in before you can comment on or make changes to this bug.