Overwriting source file leaves destination full of zeros
Jon Mitchell
jmitchell at messagelabs.com
Mon Jan 30 14:43:42 GMT 2006
Hi,
I'm a little confused over what I'm seeing when a source file is
overwritten whilst an rsync is in progress. Instead of the destination
file being truncated, or an error being raised and the destination file
removed, I get a file of the correct length, but mostly full of nulls
where previously there were none. An example is shown here:
> ls -l big_file
-rw------- 1 jonm users 168797799 Jan 30 09:06 big_file
> ls -l small_file
-rw-r--r-- 1 jonm users 9212 Jan 30 09:09 small_file
> od -c -j 168797700 big_file # show the tail of the big file
1203723004 e R a t e T r u n c \0 \0 \0 \0 \0 \0
1203723024 001 017 s o u n d . c o n n e c t e
1203723044 d 001 001 023 E t h e r n e t 0 . c o
1203723064 n n e c t e d 001 001 020 i d e 1 : 0
1203723104 . c o n n e c t e d 001 001 021 f l o
1203723124 p p y 0 . c o n n e c t e d 001 \0
1203723144 \0 \0 \0
1203723147
> sha1sum big_file
e9c56b070a077d942ac4db0ef48744cd1e5290a2 big_file
> rsync big_file big_file2
# Whilst this is running
> cp small_file big_file
> ls -l *_file*
-rw------- 1 jonm users 9212 Jan 30 09:11 big_file
-rw-r--r-- 1 jonm users 9212 Jan 30 09:09 small_file
-rw------- 1 jonm users 168797799 Jan 30 09:11 big_file2
# big_file2 file size is correct
> sha1sum big_file2
71c5981c0b22a22fc59859e6a86ea6e51edbb6fb big_file2
# sha1 differs
> od -c -j 168797700 big_file2
1203723004 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
1203723144 \0 \0 \0
1203723147
# Last bytes of the big_file are all \0
Is this behaviour what you would expect from rsync? This is rsync version 2.6.6.
Thanks,
Jon
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
More information about the rsync
mailing list