Bug 81158 - tar --delete removes files that haven't been specified
Summary: tar --delete removes files that haven't been specified
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tar
Version: 9
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Martin Stransky
QA Contact: Ben Levenson
: 84919 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2003-01-06 11:10 UTC by Martin Hejl
Modified: 2007-04-18 16:49 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-01-20 09:16:16 UTC

Attachments (Terms of Use)
Script to reproduce the bug (1.30 KB, text/plain)
2003-01-06 11:12 UTC, Martin Hejl
no flags Details

Description Martin Hejl 2003-01-06 11:10:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826

Description of problem:
issuing 'tar -f archive.tar --delete somefilename' removes files at the end of
the archive if the archive contains zero length files or symbolic links and
"somefilename" is not contained in the archive

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. create a sample archive
dd if=/dev/zero of=file1 bs=1024 count=9 2>/dev/null
echo file2_contents >file2					
# Create empty file - that's the key. if no size 0 files (or symbolic links) 
# are in the archive, everything works as expected
# alternatively we could use 'ln -s file2 file3' here
touch file3

# Make sure the size 0 file is not at the end of the archive
dd if=/dev/zero of=file4 bs=1024 count=1 2>/dev/null
tar cf test.tar file1 file2 file3 file4

2. save the file listing 
tar tf test.tar > before

3. try to delete a file that doesn't exist in the archive (this corrupts the
tar --delete -f test.tar file_does_not_exist

4. save the file listing after corruption
tar tf test.tar > after

5. show the differences
diff before after

Actual Results:  file "before" and "after" differ

Expected Results:  file "before" and "after" should be identical

Additional info:

Bug can also be reproduced on 7.2 and phoebe

Comment 1 Martin Hejl 2003-01-06 11:12:35 UTC
Created attachment 89150 [details]
Script to reproduce the bug

Comment 2 Jeff Johnson 2003-02-25 02:41:41 UTC
*** Bug 84919 has been marked as a duplicate of this bug. ***

Comment 3 Martin Hejl 2003-11-14 21:10:46 UTC
applies to Fedora Core release 1 (Yarrow) as well (tar-1.13.25-12)

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