Bug 1024095
Summary: | tar --sparse silently corrupts files on filesystems where non-empty files may have zero blocks | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Andrew J. Schorr <aschorr> | ||||||
Component: | tar | Assignee: | Ondrej Vasik <ovasik> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | unspecified | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 19 | CC: | kdudka, ovasik, praiskup, registros.it | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | tar-1.26-27.fc19 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | |||||||||
: | 1024268 (view as bug list) | Environment: | |||||||
Last Closed: | 2013-10-31 02:59:59 UTC | Type: | Bug | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 1024268 | ||||||||
Attachments: |
|
Description
Andrew J. Schorr
2013-10-28 19:35:53 UTC
This worked in 1.23, but not in 1.24. I'd run git bisect except that I can't get the autotools to run properly. I think I see the problem. The ChangeLog says, in part: 2010-08-25 Paul Eggert <eggert.edu> tar: optimize -c --sparse when file is entirely sparse * src/sparse.c (sparse_scan_file): If the file is entirely sparse, that is, if ST_NBLOCKS is zero, don't bother scanning for nonzero blocks. Idea by Kit Westneat, communicated by Bernd Schubert in <http://lists.gnu.org/archive/html/bug-tar/2010-08/msg00038.html>. Also, omit unnecessary lseek at start of file. On my Network Appliance fileserver, a small file may have zero blocks even though it is not empty. In other words, this patch is not correct on some filesystems. The bug is occurring only on my Netapp filesystem, not on ext4. Created attachment 816928 [details] fix --sparse on filesystems where small files may appear to have zero blocks This patch reverts the shortcut added here to decide that a file is empty if st_blocks is zero: http://git.savannah.gnu.org/cgit/tar.git/commit/?id=a9895fd20c957ce184091672f1623a5bedd82407 On some filesystem such as Netapp, small files are contained in the inode and have st_blocks set to zero. So this test is not reliable. Note: the ST_IS_SPARSE macro in lib/system.h will also give some false positives for the same reason. I don't know if that matters... Thanks for the report and for the report upstream, I see it was fixed already: http://lists.gnu.org/archive/html/bug-tar/2013-10/msg00031.html I'll backport that fix and submit an bodhi update. (In reply to Andrew J. Schorr from comment #4) > Note: the ST_IS_SPARSE macro in lib/system.h will also give some false > positives for the same reason. I don't know if that matters... Sorry, I missed this note. That FP should result in dumping the file into tar as-is, not recognized & stored as sparse file. As this is just about files of size < 512 bytes, it should be OK. tar-1.26-29.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/tar-1.26-29.fc20 tar-1.26-27.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/tar-1.26-27.fc19 Thanks for the prompt attention. I think the patch to ST_IS_SPARSE is probably OK, although I'm not 100% confident that the code in sparse.c:sparse_scan_file shouldn't be fixed as well. I guess if ST_IS_SPARSE is fixed, it may prevent the code from ever getting there. So maybe fixing ST_IS_SPARSE is enough... Package tar-1.26-27.fc19: * should fix your issue, * was pushed to the Fedora 19 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing tar-1.26-27.fc19' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-20256/tar-1.26-27.fc19 then log in and leave karma (feedback). tar-1.26-27.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report. tar-1.26-29.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report. |