Bug 13241 - A problem with test for xattrs transfer
A problem with test for xattrs transfer
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
3.1.2
x86 Linux
: P5 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-01-23 13:11 UTC by Michal Ruprich
Modified: 2018-01-23 13:11 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 Michal Ruprich 2018-01-23 13:11:59 UTC
Hi,

when running tests for rsync on Fedora, it fails on the xattrs.test and xattrs-hlink.test. It always fails on the line

rsync -aiX --fake-super --link-dest=../chk . ../to

with this result:

--- omitted ---
 user.dir1="need to test directory xattrs too"
 user.dir2="another xattr"
 user.dir3="this is one last one for the moment"
+user.rsync.security.selinux="unconfined_u:object_r:user_home_t:s0"
--- omitted ---

for basically every file. This only happens when the --fake-super option is on. For instance line 

rsync-3.1.2/rsync  -aiX -H --super --link-dest=../chk . ../to 

is not affected. 

Looking at the xls() method in the test, it uses 'getfattr -d'. The original files will never show the user.rsync.security.selinux="unconfined_u:object_r:user_home_t:s0" with this command. This attribute has to be specifically asked for with 'getfattr -n security.selinux'. 

Looking into the code the function sys_lgetxattr is used to get extended attributes and it asks specifically for the security.selinux attribute. And this attribute gets transferred to the destination file and is visible with 'getfattr -d'.

Example:
> mkdir dir_a dir_b
> echo "Hello world" > dir_a/foo.txt
> getfattr -d dir_a/foo.txt
> getfattr -n security.selinux dir_a/foo.txt
# file: dir_a/foo.txt
security.selinux="unconfined_u:object_r:user_home_t:s0"
> rsync -aiX --fake-super dir_a/ dir_b/
> getfattr -d dir_b/foo.txt
# file: dir_b/foo.txt
user.rsync.security.selinux="unconfined_u:object_r:user_home_t:s0"
>

As you can see rsync transfers this attribute and it is visible after issuing 'getfattr -d'. I'm not sure if this should happen but either the xattrs.txt file used for the diff in the test should be edited or there is something wrong with the --fake-super option combined with -X.

Thanks for any help on this.

Michal