Bug 4413 - Rsync skips too many files after failing to create a directory
Summary: Rsync skips too many files after failing to create a directory
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.0
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-25 11:23 UTC by Matt McCutchen
Modified: 2008-07-26 10:06 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 2007-02-25 11:23:50 UTC
When rsync fails to create a destination directory, it skips through the file list until it reaches a file whose depth is less than or equal to that of the destination directory (saved in missing_below).  This is wrong with --no-implied -dirs because the failed directory could be followed by a deeper file whose parent is not in the file list.

I reproduced this as follows:

$ mkdir src src/a src/b dest dest/b
$ echo data >src/b/file
$ chmod u-w dest
$ find . -ls
1590269  0 drwx------  4 matt  matt  96 Feb 25 12:16 .
1871292  0 drwx------  4 matt  matt  96 Feb 25 12:16 ./src
1881303  0 drwx------  2 matt  matt  48 Feb 25 12:16 ./src/a
1881688  0 drwx------  2 matt  matt  72 Feb 25 12:16 ./src/b
1882255  4 -rw-------  1 matt  matt   5 Feb 25 12:16 ./src/b/file
1881706  0 dr-x------  3 matt  matt  72 Feb 25 12:16 ./dest
1882122  0 drwx------  2 matt  matt  48 Feb 25 12:16 ./dest/b
$ rsync -i -a --relative --no-implied-dirs src/./a src/./b/file dest/
cd+++++++++ a/
rsync: recv_generator: mkdir "/home/matt/test/missing-below/dest/a" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
$ rsync -i -a --relative --no-implied-dirs src/./b/file dest/
>f+++++++++ b/file

Notice that rsync skips "b/file" on the first run when "a" also happens to be in the transfer but successfully transfers "b/file" if "a" is not in the transfer.

I tried to test this with the current CVS rsync but got the following error, which seems to indicate something awry in the incremental file-list building (rsync tried to access src/src instead of src):

$ ~/rsync/rsync/rsync -i -a --relative --no-implied-dirs src/./a src/./b/file dest/
rsync: link_stat "/home/matt/test/missing-below/src/src/./b/file" failed: No such file or directory (2)

I think the excluded_below mechanism for daemon filters has the same problem as missing_below.
Comment 1 Matt McCutchen 2007-05-27 16:34:58 UTC
CVS rsync now does the same thing as rsync 2.6.9 instead of looking for the source files in the wrong place.
Comment 2 Wayne Davison 2007-07-14 16:27:10 UTC
I just checked in a fix for this.