Bug 116779

Summary: tar --diff mishandles certain sparse files
Product: [Fedora] Fedora Reporter: Robert Nichols <rnichols42>
Component: tarAssignee: Peter Vrabec <pvrabec>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-09 13:39:38 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:

Description Robert Nichols 2004-02-25 02:25:50 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.0.2)
Gecko/20021216

Description of problem:
When running "tar --diff" with a tar archive created with the
"--sparse" option and the comparison fails (legitimately) on a sparse
file containing certain data patterns, tar loses synchronization in
the archive file.  Correct processing of subsequent files in the
archive is uncertain due to the loss of synchronization.

The steps shown below reliably reproduce the problem on a file system
with a 4K block size.

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

How reproducible:
Always

Steps to Reproduce:
1. $ echo hello | dd of=testfile bs=1k seek=5  #create sparse file
2. $ tar -cSf test.tar testfile #create archive with -S (--sparse)
3. $ echo junk | dd of=testfile bs=1k seek=4  #corrupt the file
4. $ tar -df test.tar  #compare with archive
    

Actual Results:  Messages from tar:
testfile: Mod time differs
testfile: Could only read 5 of 512 bytes
tar: Skipping to next header
tar: Error exit delayed from previous errors


Expected Resuults:  These messages from tar:
testfile: Mod time differs
testfile: Size differs


Additional info:

Same bug present in tar-1.13.25-4.7.1 (Red Hat Linux 7.1).

Comment 1 Peter Vrabec 2004-11-03 11:59:28 UTC
I've tryed newer version of tar from upstream.
What do u thing about this results, satisfactory?

$ echo hello | dd of=testfile bs=1k seek=5
0+1 records in
0+1 records out
$ tar -cSf test.tar testfile
$ echo junk | dd of=testfile bs=1k seek=4
0+1 records in
0+1 records out
$ tar -df test.tar
testfile: Mod time differs
testfile: File fragment at 4096 is not a hole
$ tar --version
tar (GNU tar) 1.14
Copyright (C) 2004 Free Software Foundation, Inc.



Comment 2 Robert Nichols 2004-11-03 14:43:37 UTC
That appears quite promising.  In rechecking the bahavior of
tar-1.13.25-12, I just discovered that the details of the error
messages depend on whether the tar executable has been prelinked.
My original report was for a tar binary that was _not_ prelinked.
With a prelinked tar I do not see the "Skipping to next header" or
"Error exit delayed ..." messages.

If you get the same results with and without prelinking, then
I'd say it is very likely the bug has been fixed.