Bug 143969

Summary: Tar can't reliably skip over sparse files in archive
Product: [Fedora] Fedora Reporter: Robert Nichols <rnichols42>
Component: tarAssignee: Peter Vrabec <pvrabec>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: medium    
Version: 3CC: barryn, ofeeley
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-01-18 08:20:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch fix tar-1.14 none

Description Robert Nichols 2005-01-02 23:04:55 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
When listing (-t) or extracting (-x) a subset of files in a tar
archive, and a sparse file stored with the -S option is being skipped
because it does not match the selection criteria, tar complains about
an invalid sparse member in the archive and attempts to skip to the
next header.

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

How reproducible:
Always

Steps to Reproduce:
1. echo hello | dd obs=1k seek=50 of=testfile
2. echo anything >file2
3. tar -cSf test.tar testfile file2
4. tar -tvf test.tar file2
    

Actual Results:  
tar: testfile: invalid sparse archive member
tar: Skipping to next header
-rw-r--r-- root/root         9 2005-01-02 16:49:13 file2
tar: Error exit delayed from previous errors


Expected Results:  
-rw-r--r-- root/root         9 2005-01-02 16:49:13 file2


Additional info:

"Skipping to next header" is inherently an uncertain operation which
can fail badly if one of the archive members is itself a tar archive.
 This makes use of tar for backups risky if sparse files are involved.

This is probably related to bug 11679.

This version of tar (1.14-4) appears to behave properly if the sparse
member is actually being listed or extracted from the archive.

Comment 1 Robert Nichols 2005-01-02 23:07:52 UTC
Typo -- the relation is to bug 116779.

Comment 2 Peter Vrabec 2005-01-06 14:11:42 UTC
It's fixed in tar-1.15.1.
http://www.gnu.org/software/tar/tar.html#downloading

Comment 3 Peter Vrabec 2005-01-06 14:13:48 UTC
Created attachment 109423 [details]
patch fix tar-1.14

Comment 4 Robert Nichols 2005-01-08 21:00:34 UTC
I've tested the above patch, and it appears to correct the sparse file
problem completely.

Comment 5 Oisin C. Feeley 2005-01-25 21:46:34 UTC
As of Jan 25 2005 the available "tar" on a fully yum-updated system
still apparently has this problem.  How long does it take for this
sort of fix to propagate into the repository as a new .rpm ?

I'm getting a similar problem with an archive created on Red Hat 9:

[root@ars predec2004]# tar -xvf rec00628bkup.tar
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains obsolescent base-64 headers
tar: Read 1320 bytes from rec00628bkup.tar
tar: Error exit delayed from previous errors