Created attachment 9236 [details] Patch Description of problem: rsync -X preserves extended attributes on files. It works partially; however, if combined with rsync options which preserve the file owner and/or group, it is partially ineffective. This is because rsync calls chown(2) after setting attributes, and chown removes security attributes (as in capabilities(5)). Steps to Reproduce: $ touch foo $ sudo setcap cap_dac_read_search=pe foo $ getcap foo foo = cap_dac_read_search+ep $ sudo rsync -X foo foo.1 $ getcap foo.1 foo.1 = cap_dac_read_search+ep $ sudo rsync -aX foo foo.2 $ getcap foo.2 $ This report originates from https://bugzilla.redhat.com/show_bug.cgi?id=981797
*** Bug 10295 has been marked as a duplicate of this bug. ***
Created attachment 9492 [details] Move xattr-setting after chowning. Here's a patch I'm considering that also moves the mtime-setting code, along with the xattr-setting code (so that the modify time still gets set after setting xattrs). Please do some testing and see if anything breaks.
I've committed my proposed patch.