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
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.
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.
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.
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.
Created attachment 472849 [details] Upstream patch for rsync-3.0.7 Removed one line (--fuzz=1) in Hunk #2 of receiver.c diff.
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.
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