Bug 12199 - multiple link-dest dirs not working
multiple link-dest dirs not working
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
3.0.6
All All
: P5 major
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-01 11:27 UTC by Brian J. Murrell
Modified: 2016-09-06 11:47 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 Brian J. Murrell 2016-09-01 11:27:28 UTC
If I try to use multiple --link-dest dirs they are not being searched exhaustively for a file to link to.  Observe:

# rsync -aiSPHAX --link-dest $PWD/monthly.0/f/sbin/ --link-dest $PWD/monthly.1.new/f/sbin/ --link-dest $PWD/weekly.3/f/sbin/ weekly.3/f/sbin/ weekly.3.new/f/sbin/
.d..t...... ./
cf........x consoletype
# ls -li */f/sbin/consoletype
705305954 -rwxr-xr-x. 3 root root 7896 Nov  4  2014 monthly.0/f/sbin/consoletype
705305954 -rwxr-xr-x. 3 root root 7896 Nov  4  2014 monthly.1/f/sbin/consoletype
705305954 -rwxr-xr-x. 3 root root 7896 Nov  4  2014 monthly.1.new/f/sbin/consoletype
171574019 -rwxr-xr-x. 1 root root 7896 Nov  4  2014 weekly.3/f/sbin/consoletype
403439863 -rwxr-xr-x. 1 root root 7896 Nov  4  2014 weekly.3.new/f/sbin/consoletype
# ls -lZ */f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:consoletype_exec_t:s0 monthly.0/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:consoletype_exec_t:s0 monthly.1/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:consoletype_exec_t:s0 monthly.1.new/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:unlabeled_t:s0 weekly.3/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:unlabeled_t:s0 weekly.3.new/f/sbin/consoletype
# rm -f weekly.3.new/f/sbin/consoletype
# rsync -aiSPHAX --link-dest $PWD/weekly.3/f/sbin/ weekly.3/f/sbin/ weekly.3.new/f/sbin/
# ls -li */f/sbin/consoletype
705305954 -rwxr-xr-x. 3 root root 7896 Nov  4  2014 monthly.0/f/sbin/consoletype
705305954 -rwxr-xr-x. 3 root root 7896 Nov  4  2014 monthly.1/f/sbin/consoletype
705305954 -rwxr-xr-x. 3 root root 7896 Nov  4  2014 monthly.1.new/f/sbin/consoletype
171574019 -rwxr-xr-x. 2 root root 7896 Nov  4  2014 weekly.3/f/sbin/consoletype
171574019 -rwxr-xr-x. 2 root root 7896 Nov  4  2014 weekly.3.new/f/sbin/consoletype
# ls -lZ */f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:consoletype_exec_t:s0 monthly.0/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:consoletype_exec_t:s0 monthly.1/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:consoletype_exec_t:s0 monthly.1.new/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:unlabeled_t:s0 weekly.3/f/sbin/consoletype
-rwxr-xr-x. root root system_u:object_r:unlabeled_t:s0 weekly.3.new/f/sbin/consoletype

So as you can see, in both cases, the target file was created and had the correct (selinux) xattrs but in the first case it was created as a separate file and in the second case it was created as a link, as I would have expected in both cases.
Comment 1 Kevin Korb 2016-09-01 12:14:57 UTC
I have been discussing this in IRC for more than an hour now.  The OP's complaint is not that multiple --link-dest paths aren't searched.  The OP's complaint is that rsync finds an apparent match in an early --link-dest path and it does not notice a more precise (metadata) match in a subsequent --link-dest path.  The result is rsync making a new file to record a change in xattr even though both file+xattr already exist in the declared link-dests.
Comment 2 Brian J. Murrell 2016-09-06 11:47:12 UTC
No triage on this at least?