DO NOT REPLY [Bug 4080] New: rsync can't find basis dirs with -n and nonexistent destination

samba-bugs at samba.org samba-bugs at samba.org
Mon Sep 4 21:53:31 GMT 2006


https://bugzilla.samba.org/show_bug.cgi?id=4080

           Summary: rsync can't find basis dirs with -n and nonexistent
                    destination
           Product: rsync
           Version: 2.6.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: hashproduct+rsync at gmail.com
         QAContact: rsync-qa at samba.org


The man page says that relative basis directory paths are to be relative to the
destination directory.  This usually works because the receiving rsync chdirs
into the destination directory in get_local_name and then follows the paths
verbatim.

However, if --dry-run is on and the destination directory does not exist, the
receiver skips the chdir and tries to follow basis directory paths from its
original working directory, so it doesn't find the correct basis directories. 
The dry run itemizes transfers where a real run might itemize nothing, local
creations, or hard links, violating the principle that rsync should produce the
same output with and without --dry-run.

As a fix, I propose that, when --dry-run is on and the destination directory
does not exist, the receiver should chdir instead into its parent directory. 
(The parent has to exist in order for the destination to be created on a real
run, so I think it's reasonable to also expect the parent to exist on a dry
run.)  Then the receiver should remove an initial ../ from each basis directory
path that has one and discard basis directory paths that do not begin with ../


More information about the rsync mailing list