Bug 8659 - link-by-hash.diff: Fix error when running without --link-by-hash
Summary: link-by-hash.diff: Fix error when running without --link-by-hash
Status: RESOLVED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-14 03:47 UTC by Chris Dunlop
Modified: 2011-12-16 03:13 UTC (History)
0 users

See Also:


Attachments
Fix error when running without --link-by-hash (1.34 KB, patch)
2011-12-14 03:47 UTC, Chris Dunlop
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dunlop 2011-12-14 03:47:10 UTC
Created attachment 7178 [details]
Fix error when running without --link-by-hash

Don't pass F_SUM(file) into receive_data() if not using --link-by-hash.

When running without --link-by-hash (and without --checksum), F_SUM(file)
isn't allocated. However this location was being unconditionally passed into
receive_data() which would then write into it, stamping on whatever happened
to be there.

The actual error seen depends on what exactly was getting stamped on, which depends on the file list at the time, but on my box...

Unpatched:

$ mkdir -p /tmp/src.d/{a,b} /tmp/dst.d
$ echo foo > /tmp/src.d/a/a
$ ln /tmp/src.d/{a,b}/a

$ ./rsync -av /tmp/src.d /tmp/dst.d
sending incremental file list
src.d/
src.d/a/
src.d/a/a
src.d/b/
src.d/b/a
received request to transfer non-regular file: 8 [receiver]
rsync error: protocol incompatibility (code 2) at ../rsync/rsync.c(403) [receiver=3.1.0dev]

Patched:

$ ./rsync -av /tmp/src.d /tmp/dst.d
sending incremental file list
src.d/
src.d/a/
src.d/a/a
src.d/b/
src.d/b/a

sent 228 bytes  received 70 bytes  596.00 bytes/sec
total size is 8  speedup is 0.03
Comment 1 Wayne Davison 2011-12-16 03:13:46 UTC
The latest code uses "sender_file_sum", and thus avoids this issue.  Thanks for the report!