Bug 2781 - rsync linked files not listed as uptodate
rsync linked files not listed as uptodate
Status: CLOSED FIXED
Product: rsync
Classification: Unclassified
Component: core
2.6.5
x86 Linux
: P3 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-09 01:39 UTC by Ian! D. Allen
Modified: 2006-03-12 02:56 UTC (History)
0 users

See Also:


Attachments
Fix the logging of hard-linked files when verbose is > 1 (1.75 KB, patch)
2005-06-09 09:45 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian! D. Allen 2005-06-09 01:39:15 UTC
rsync  version 2.6.5  protocol version 29

Rsync is broken and now claims that all linked files are not "uptodate".

Create a directory and two files:

    bash-3.00$ mkdir a
    bash-3.00$ date >a/foo
    bash-3.00$ date >a/bar

rsync the directory; note a/foo and b/foo get updated:

    bash-3.00$ rsync -avvH a b
    building file list ...
    done
    created directory b
    delta-transmission disabled for local transfer or --whole-file
    a/
    a/bar
    a/foo
    total: matches=0  tag_hits=0  false_alarms=0 data=58
    sent 265 bytes	received 70 bytes  670.00 bytes/sec
    total size is 58  speedup is 0.17

rsync the directory again; note that a/foo and b/foo are "uptodate":

    bash-3.00$ rsync -avvH a b
    building file list ...
    done
    delta-transmission disabled for local transfer or --whole-file
    a/bar is uptodate
    a/foo is uptodate
    total: matches=0  tag_hits=0  false_alarms=0 data=0
    sent 127 bytes	received 38 bytes  330.00 bytes/sec
    total size is 58  speedup is 0.35

Change a/bar to be a link to a/foo:

    bash-3.00$ rm a/bar
    bash-3.00$ ln a/foo a/bar

Remove the destination directory and rsync:

    bash-3.00$ rm -r b
    bash-3.00$ rsync -avvH a b
    building file list ...
    done
    created directory b
    delta-transmission disabled for local transfer or --whole-file
    a/
    a/foo
    a/bar => a/foo
    total: matches=0  tag_hits=0  false_alarms=0 data=29
    sent 212 bytes	received 60 bytes  544.00 bytes/sec
    total size is 58  speedup is 0.21

rsync the directory again; note that only a/bar is listed as "uptodate",
and rsync incorrectly says it needs to update a/foo:

    bash-3.00$ rsync -avvH a b
    building file list ...
    done
    delta-transmission disabled for local transfer or --whole-file
    a/bar is uptodate
    a/foo
    total: matches=0  tag_hits=0  false_alarms=0 data=0
    sent 138 bytes	received 39 bytes  354.00 bytes/sec
    total size is 58  speedup is 0.33

Repeating the rsync, it always says the same (incorrect) thing.
Comment 1 Wayne Davison 2005-06-09 09:34:15 UTC
Rsync doesn't output "uptodate" for hardlinks, but it should be outputting "is a
hard link" messages for the item instead of outputting its name.

The easiest way to partially work around the problem is to use the -i option. 
This switches over to the itemized list of changes, and the output will look
something like this:

[...].d        a/
.f        a/bar
hf....... a/foo
[...]

The only problem with that output is that the dots after the "hf" (h=hard-link,
f=file, .=no-change in attribute) should really be spaces (which indicates that
an item was completely unchanged).

I'll attach a fix for these problems.
Comment 2 Wayne Davison 2005-06-09 09:45:28 UTC
Created attachment 1266 [details]
Fix the logging of hard-linked files when verbose is > 1

This patch fixes the aforementioned problems.  I haven't tested it extensively
enough to know for sure that it causes the correct output for all itemized
update possibilities, so I really should add a test case to the testsuite dir
to do that (hopefully soon).
Comment 3 Ian! D. Allen 2005-06-09 11:35:26 UTC
Your patch at least removed the huge number of incorrectly reported out-of-date
files from the output.  Thanks for the quick fix; I was drowning in output.
Comment 4 Wayne Davison 2005-06-30 10:37:24 UTC
I checked-in my fix into CVS a while back and added a test case to verify that
the -vv and --itemized output remains consistent.