Bug 3846 - rsync silently transfers blocks of zero bytes on read errors
Summary: rsync silently transfers blocks of zero bytes on read errors
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.5
Hardware: All Linux
: P3 major (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-18 15:13 UTC by jochen
Modified: 2006-10-15 13:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jochen 2006-06-18 15:13:28 UTC
when rsync fails to read part of a file, it silently transfers blocks of zero bytes instead of the actual data.

This renders rsync useless for most kinds of backup applications, because in case of a hardware failure, all backups may be already destroyed by blocks of zeros, and you have a hard time to figure out which files are intact (i.e. should contain such blocks) and which are not (i.e. rsync introduced such blocks), because there isn't even a information in any log.

I'd suggest to introduce an option --ignore-read-errors which exhibits the current behaviour and fail on read-errors as per default.
Comment 1 Matt McCutchen 2006-06-18 19:11:25 UTC
Rsync sends zeroes in an attempt to get as much of the new data to the receiver as possible; one could argue that the receiving rsync should take the data from the same offset in the basis file instead.  It also sabotages the post-transfer MD4 checksum on lines 355-357 of match.c:

	/* If we had a read error, send a bad checksum. */
	if (buf && buf->status != 0)
		file_sum[0]++;

That will cause the receiving rsync to delete the temporary file on line 641 of receiver.c, leaving the old but valid version of the source file intact.  Rsync will produce a message like this:

   WARNING: <file> failed verification -- update discarded (will try again)

So I don't think there's a problem.  Wayne, please correct me if I am wrong.
Comment 2 jochen 2006-06-21 08:42:00 UTC
ah, sorry. After double-checking this only happened with 2.6.5, i.e. the current version 2.6.8 actual throws an error message.
Comment 3 Wayne Davison 2006-09-17 17:53:52 UTC
Fixed in newer versions.