Bug 3543 - [ACL] rsync calls default_perms_for_dir on omitted implied dirs before ensuring they exist
Summary: [ACL] rsync calls default_perms_for_dir on omitted implied dirs before ensuri...
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.7
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-22 18:37 UTC by Matt McCutchen
Modified: 2006-03-12 02:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt McCutchen 2006-02-22 18:37:12 UTC
Run the following in an empty directory:
    mkdir a
    touch a/b
    rsync --relative --no-implied-dirs a/b dest/

The following error messages result (my indentation):
    default_perms_for_dir: sys_acl_get_file(a, SMB_ACL_TYPE_DEFAULT):
        No such file or directory, falling back on umask
    default_perms_for_dir: sys_acl_get_file(a, SMB_ACL_TYPE_DEFAULT):
        No such file or directory, falling back on umask
    rsync error: some files could not be transferred (code 23) at main.c(882)
        [sender]

The trouble is that rsync is asking for the default permissions of dest/a before dest/a has been created.  Moving the calculation of destination default permissions later in recv_generator, after the creation of implied directories, would probably fix the problem, but I'm not familiar enough with the logic of that 520-line function to know where to put it.

Separating this calculation from the fuzzy list calculation would also fix what appears to be a logic error.  If --fuzzy is given and --perms is not given and the first file to be received into a directory is not a regular file, parent_dirname will be set to the directory but the fuzzy list will not be updated.  When rsync does receive a regular file into the directory, it will assume the fuzzy list does not need to be updated and use the wrong list.
Comment 1 Wayne Davison 2006-02-23 14:19:33 UTC
This report revealed several problems with -R --no-implied-dirs:

- The --fuzzy option could generate an I/O error if the destination
  dir didn't exist yet.

- Symlinks and devices could fail to be created if they were the
  first item in an implied dir that didn't exist yet.

These bugs have been fixed on the trunk by having the generator create the implied directory path (if it is missing) near the top of recv_generator().

The other two bugs mentioned with an rsync patched with acls.diff have also been fixed:

- Now that the missing dirs have been created, default_perms_for_dir() has nothing to complain about.

- The logic error in the --fuzzy code that could leave fuzzy_dirlist unset has also been fixed (and indeed, had to be fixed on the trunk due to the new find-missing-implied-dir logic).

The acls.diff has been updated in CVS and in the latest "nightly" tar file.

Thanks for the report!