Bug 10295 - do_lchown() after set_xattr() causes xattrs to be dropped.
Summary: do_lchown() after set_xattr() causes xattrs to be dropped.
Status: RESOLVED DUPLICATE of bug 10163
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.0
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
Depends on:
Reported: 2013-11-28 05:14 UTC by Christopher Oliver
Modified: 2013-11-28 21:20 UTC (History)
0 users

See Also:

Candidate patch on rsync 3.1.0. Please review. (1009 bytes, patch)
2013-11-28 05:14 UTC, Christopher Oliver
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Oliver 2013-11-28 05:14:14 UTC
Created attachment 9489 [details]
Candidate patch on rsync 3.1.0.  Please review.


    rsync -Xa /foo /bar


    Copies will have the same security attributes as the originals.


    Copies have security attributes cleared.

Please look at rsync-3.1.0/rsync.c lines 492 & 541 in the context of chown_common() from linux kernel fs/open.c around the 500th line.  It appears that the SET{G,U}ID bits and security attrs are cleared.

Relevant kernel line:

        if (!S_ISDIR(inode->i_mode))
                newattrs.ia_valid |=
                        ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;

Suggestion: move the SUPPORT_XATTRS code invocation after the if (change_uid... block.
Comment 1 Wayne Davison 2013-11-28 21:06:05 UTC
The xattr-setting code was moved prior to the mtime setting due to some instances of xattr-setting tweaking it (e.g. os x resource fork info).  So, to move it elsewhere, we'll need to change the xattr code (which currently signals the time-setting code when it thinks that the mtime might have been tweaked).
Comment 2 Wayne Davison 2013-11-28 21:20:28 UTC

*** This bug has been marked as a duplicate of bug 10163 ***