Bug 5298 - problem with --fake-super, --link-dest, and --xattrs
problem with --fake-super, --link-dest, and --xattrs
Status: CLOSED FIXED
Product: rsync
Classification: Unclassified
Component: core
3.0.0
x86 Linux
: P3 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-02 16:16 UTC by Lukasz Stelmach
Modified: 2008-07-26 10:33 UTC (History)
0 users

See Also:


Attachments
Fix interaction between --fake-super and --link-dest w/--xattrs (3.86 KB, patch)
2008-03-07 18:21 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukasz Stelmach 2008-03-02 16:16:23 UTC
I may suspect there is a problem with the options: fake-super, xattrs and acls.

Let me present an example. (create a test directory and enter it as root, configure rsyncd with the test module too)

rm -rf source
mkdir source

echo data2 > source/file2
echo data1 > source/file1
chown 1000:1000 source/file1
setfattr -n user.DOSATTRIB -v "0x30783031" source/file1
setfacl -m g:wheel:rw- source/file1

rsync $OPTS -av source/ backup::test/dest1
rsync $OPTS -av --link-dest ../dest1 source/ backup::test/dest2

-------------------------------------------
For OPTS=""
../test/dest1:
total 16
-rw-rw-r-- 2 backup nobody 6 Mar  2 23:00 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:00 file2

../test/dest2:
total 16
-rw-rw-r-- 2 backup nobody 6 Mar  2 23:00 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:00 file2

I am not sure file1 should get 664 but this may be the problem of stat(2). The number of hard links is OK.

# file: ../test/dest1/file1
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest1/file2
user.rsync.%stat="100644 0,0 0:0"

# file: ../test/dest2/file1
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest2/file2
user.rsync.%stat="100644 0,0 0:0"
-------------------------------------------
For OPTS=--acls ls is the same as above and getfattr

# file: ../test/dest1/file1
user.rsync.%aacl=0sgAAAAAQAAAAGAAAAgAAAAAoAAAAGAAAA
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest1/file2
user.rsync.%stat="100644 0,0 0:0"

# file: ../test/dest2/file1
user.rsync.%aacl=0sgAAAAAQAAAAGAAAAgAAAAAoAAAAGAAAA
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest2/file2
user.rsync.%stat="100644 0,0 0:0"

Seems OK.
-------------------------------------------
For OPTS=--xattrs
# file: ../test/dest1/file1
user.DOSATTRIB="0x01"
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest1/file2
user.rsync.%stat="100644 0,0 0:0"

# file: ../test/dest2/file1
user.DOSATTRIB="0x01"
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest2/file2
user.rsync.%stat="100644 0,0 0:0"

../test/dest1:
total 16
-rw-rw-r-- 2 backup nobody 6 Mar  2 23:05 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:05 file2

../test/dest2:
total 16
-rw-rw-r-- 2 backup nobody 6 Mar  2 23:05 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:05 file2

Still OK. Number of links is two. user.DOSATTRIB is preserved.
-------------------------------------------
For OPTS="-AX" (the manual does not forbid this)
# file: ../test/dest1/file1
user.DOSATTRIB="0x01"
user.rsync.%aacl=0sgAAAAAQAAAAGAAAAgAAAAAoAAAAGAAAA
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest1/file2
user.rsync.%stat="100644 0,0 0:0"

# file: ../test/dest2/file1
user.DOSATTRIB="0x01"
user.rsync.%stat="100664 0,0 1000:1000"

# file: ../test/dest2/file2
user.rsync.%stat="100644 0,0 0:0"

../test/dest1:
total 16
-rw-rw-r-- 1 backup nobody 6 Mar  2 23:06 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:06 file2

../test/dest2:
total 16
-rw-rw-r-- 1 backup nobody 6 Mar  2 23:06 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:06 file2

Well this is really odd. file1 gets copied twice each time with different xattrs!
-------------------------------------------

What makes the game even more fascinating is the XFS filesystem which stores ACLs  as trusted.SGI_ACL_FILE extended attribute and generates  system.posix_acl_access on the fly. One might think that this means that --xattrs can be used without --acls and XFS will be preserved. That's true but  for some reason rsync  copies files with trusted.SGI_ACL_FILE twice  instead of linking it. Even when the values are the same.

# file: ../test/dest1/file1
user.DOSATTRIB="0x01"
user.rsync.%stat="100664 0,0 1000:1000"
user.rsync.trusted.SGI_ACL_FILE=0sAAAABQAAAAH/////AAYAAAAAAAT/////AAQUCAAAAAgAAAAKAAYAAAAAABD/////AAZJRgAAACD/////AAQAAA==

# file: ../test/dest1/file2
user.rsync.%stat="100644 0,0 0:0"

# file: ../test/dest2/file1
user.DOSATTRIB="0x01"
user.rsync.%stat="100664 0,0 1000:1000"
user.rsync.trusted.SGI_ACL_FILE=0sAAAABQAAAAH/////AAYAAAAAAAT/////AAQUCAAAAAgAAAAKAAYAAAAAABD/////AAZJRgAAACD/////AAQAAA==

# file: ../test/dest2/file2
user.rsync.%stat="100644 0,0 0:0"

../test/dest1:
total 16
-rw-rw-r-- 1 backup nobody 6 Mar  2 23:09 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:09 file2

../test/dest2:
total 16
-rw-rw-r-- 1 backup nobody 6 Mar  2 23:09 file1
-rw-r--r-- 2 backup nobody 6 Mar  2 23:09 file2
Comment 1 Wayne Davison 2008-03-07 18:21:18 UTC
Created attachment 3170 [details]
Fix interaction between --fake-super and --link-dest w/--xattrs

This patch fixes a couple problems with the --fake-super interaction between the xattr code, including the use of fake-xattr ACLs, and non-user namespace xattrs.
Comment 2 Wayne Davison 2008-03-07 18:26:48 UTC
Thanks for pointing this out!  This should be fixed in the latest git repository version and the latest nightly tar file.