Bug 8342 - rsync can't handle populate dirs without u+rx permissions
Summary: rsync can't handle populate dirs without u+rx permissions
Status: ASSIGNED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.9
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-02 18:59 UTC by Christopher Key
Modified: 2011-09-10 21:17 UTC (History)
0 users

See Also:


Attachments
patch described in bug 8342 (676 bytes, patch)
2011-08-02 19:02 UTC, Christopher Key
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Key 2011-08-02 18:59:33 UTC
When running rsync with root at the source, it is quite possible to end up wanting to transfer directories with 'strange' permissions.  At present, it the destination doesn't have root access too, these directories cannot be populated.

For example:

# mkdir source
# mkdir source/dir
# touch source/dir/file
# chmod 400 source/dir
# sudo rsync -rltp source user@host:destination
rsync: recv_generator: failed to stat ".../destination/source/dir/file": Permission denied (13)

In order to create files in a directory without root, it needs to have u=rwx permissions.  There is currently a workaround to temporarily add u+w write permissions to a directory whilst creating files and to correct the permissions afterwards, specifically to deal with read-only directories (u=rx).  The attached patch extends this to temporarily add u+rwx permissions instead, allowing all directories to be transferred.
Comment 1 Christopher Key 2011-08-02 19:02:32 UTC
Created attachment 6748 [details]
patch described in bug 8342
Comment 2 Wayne Davison 2011-09-10 21:17:47 UTC
I have included the patch to have rsync temporarily tweak dirs with u+r and u+x for a non-root receiver, however if a parent dir lacks u+x, any fudged permissions inside subdirs of that directory won't get fixed, and indeed, an incremental recursion copy can tweak the parent dir's permissions back to u-x too soon for the copy to even complete (the latter of which you can work around via --no-inc-recursive because the directory-permission cleanup all happens at the end with --no-i-r).  I'll leave this open pending contemplations of a fuller fix, but it may just be that we don't fully support non u+x hierarchies for non-root transfers.