Bug 3549 - rsync applies umask to some directories even when a default ACL takes effect
rsync applies umask to some directories even when a default ACL takes effect
Status: CLOSED FIXED
Product: rsync
Classification: Unclassified
Component: core
2.6.7
All All
: P3 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-23 18:58 UTC by Matt McCutchen
Modified: 2006-03-12 02:56 UTC (History)
0 users

See Also:


Attachments
Uses a new function do_mkdir_defmode to create some directories (4.78 KB, patch)
2006-02-23 18:59 UTC, Matt McCutchen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt McCutchen 2006-02-23 18:58:48 UTC
Starting in a new, empty directory with ACLs supported, run:
    umask 0077
    setfacl -dm u::rwx,g::rwx,o::rwx .
    mkdir src
    touch src/foo
    rsync --relative --no-implied-dirs src/foo dest/
Rsync creates dest/src with 700 permissions even though the default ACL specifies 777 permissions.

The trouble is that the receiving rsync restricts the mode of such "auxiliary directories" as omitted implied directories and directories created on the way to the backup directory.  The receiving rsync runs with umask 0 and thus applies the umask to the permissions it gives to mkdir; if the new directory's containing directory is a default ACL, mkdir will apply the default ACL automatically, but the umask should not be applied.

The correct technique, which is already used in get_local_name to create a top-level destination directory outside the transfer, is to set the umask back to the original umask temporarily and pass 0777 to mkdir.  The patch I will soon attach factors this technique out into a function do_mkdir_defmode in util.c and changes both the current get_local_name code and calls to do_mkdir(x, 0777 & ~orig_umask) to calls to do_mkdir_defmode(x).

Even though the patch is only needed in the presence of ACLs, it does not mention ACLs itself, so it can be applied to the trunk.
Comment 1 Matt McCutchen 2006-02-23 18:59:34 UTC
Created attachment 1756 [details]
Uses a new function do_mkdir_defmode to create some directories
Comment 2 Wayne Davison 2006-02-23 20:07:28 UTC
This is a nice, simple bugfix/cleanup.  Committing to the trunk.  Thanks again!