The Samba-Bugzilla – Bug 3549
rsync applies umask to some directories even when a default ACL takes effect
Last modified: 2006-03-12 02:56:56 UTC
Starting in a new, empty directory with ACLs supported, run:
setfacl -dm u::rwx,g::rwx,o::rwx .
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.
Created attachment 1756 [details]
Uses a new function do_mkdir_defmode to create some directories
This is a nice, simple bugfix/cleanup. Committing to the trunk. Thanks again!