Bug 530866

Summary: rsync --sparse does not properly copy sparse files
Product: Red Hat Enterprise Linux 5 Reporter: Brian J. Murrell <brian>
Component: rsyncAssignee: Vojtech Vitek <vvitek>
Status: CLOSED ERRATA QA Contact: Aleš Mareček <amarecek>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: amarecek, hripps, ovasik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 668811 737539 (view as bug list) Environment:
Last Closed: 2011-07-21 10:49:44 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:
Bug Depends On:    
Bug Blocks: 668811, 737539    
Attachments:
Description Flags
Upstream patch for rsync-3.0.7 none

Description Brian J. Murrell 2009-10-25 18:45:17 UTC
Description of problem:
rsync --sparse does not properly replicate the truly sparse state of a truly sparse file

Version-Release number of selected component (if applicable):
rsync  version 2.6.8  protocol version 29
Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, ACLs, xattrs, symlinks, batchfiles,
              inplace, IPv6, 64-bit system inums, 64-bit internal inums


How reproducible:
100%

Steps to Reproduce:
# dd if=/dev/zero of=/tmp/sparse_file bs=1M count=0 seek=5
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000451882 seconds, 0.0 kB/s
# ls -ls /tmp/sparse_file
0 -rw-rw-r-- 1 root root 5242880 Oct 25 14:30 /tmp/sparse_file
# rsync --sparse /tmp/sparse_file /var/tmp
# ls -ls /var/tmp/sparse_file 
12 -rw-rw-r-- 1 root root 5242880 Oct 25 14:31 /var/tmp/sparse_file

Expected results: [from Ubuntu 9.04]
$ dd if=/dev/zero of=/tmp/sparse_file bs=1M count=0 seek=5
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.4013e-05 s, 0.0 kB/s
$ ls -ls /tmp/sparse_file 
0 -rw-r--r-- 1 brian brian 5242880 2009-10-25 11:13 /tmp/sparse_file
$ rsync --sparse /tmp/sparse_file /var/tmp
$ ls -ls /var/tmp/sparse_file 
0 -rw-r--r-- 1 brian brian 5242880 2009-10-25 14:29 /var/tmp/sparse_file

As you can see, rsync on Ubuntu works properly.  It is version:

rsync  version 3.0.5  protocol version 30
Copyright (C) 1996-2008 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes

Comment 1 Jan Zeleny 2010-04-08 07:53:21 UTC
I tried on Ubuntu 9.04 (rsync 3.0.5), 9.10 (rsync 3.0.6) and Fedora 12 (rsync
3.0.7). I reproduced this issue on all systems. Then I did some digging and a
test program. I think this issue describes only this particular case, when you
create file with dd, but you copy no data to it (count=0). For now I'm not even
sure the bug is worth fixing. The fix would need to find out how dd writes this
file and use it in rsync.

Comment 2 Brian J. Murrell 2010-04-08 14:21:01 UTC
Hrm.  Indeed.  I just followed my reproducer case exactly and now the results on Ubuntu 9.04 are different than they were when I tested this last time:

$ uname -a
Linux brian-laptop 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010 i686 GNU/Linux
$ cat /etc/issue
Ubuntu 9.10 \n \l

$ dd if=/dev/zero of=/tmp/sparse_file bs=1M count=0 seek=5
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.2635e-05 s, 0.0 kB/s
$ ls -ls /tmp/sparse_file
0 -rw-r--r-- 1 brian brian 5242880 2010-04-08 10:17 /tmp/sparse_file
$ rsync --sparse /tmp/sparse_file /var/tmp
$ ls -ls /var/tmp/sparse_file 
12 -rw-r--r-- 1 brian brian 5242880 2010-04-08 10:17 /var/tmp/sparse_file

I wonder why the difference between then and now.

Comment 3 Brian J. Murrell 2010-04-08 14:40:01 UTC
FWIW, I've bug reported this upstream at https://bugzilla.samba.org/show_bug.cgi?id=7337.  I guess we will see what the authors say about this issue.

Comment 5 RHEL Program Management 2010-08-09 18:23:06 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 6 Vojtech Vitek 2011-01-11 16:53:22 UTC
Created attachment 472849 [details]
Upstream patch for rsync-3.0.7

Removed one line (--fuzz=1) in Hunk #2 of receiver.c diff.

Comment 8 RHEL Program Management 2011-01-11 19:57:42 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 9 RHEL Program Management 2011-01-12 15:07:24 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 15 errata-xmlrpc 2011-07-21 10:49:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0999.html