rsync: recv_generator and stat errors

Matt McCutchen hashproduct+rsync at
Sat Jan 27 22:05:58 GMT 2007

I don't know exactly which issue you're referring to, so I'll discuss both:

> rsync eating bandwidth without doing anything
> tyko brown
> Wed, 24 May 2006 02:09:08 -0700
> rsync fails to make a directory at the remote site, but continues anyway. $
> rsync -av local building file list ... done rsync:
> recv_generator: mkdir "local": Permission denied (2) stat local : No such
> file or directory You can do this locally too - rsync to a usb device, then
> unplug the device. rsync keeps doing something.

The bandwidth-wasting issue was fixed a while ago.  If the generator
fails to make a directory, it prints "*** Skipping any contents from
this failed directory ***" and skips requesting the sender to transmit
files inside the directory.

> rsync: recv_generator: mkdir "dirname" No such file or directory (2)
> stat  dirname No such file or directory

What exactly did you do to get this error message?  I found one
situation that produces the error with the current CVS rsync.  At the
beginning, src/a/b/c is an directory and dest is an empty, unwritable

$ mkdir src src/a src/a/b src/a/b/c dest
$ chmod a-w dest
$ ~/rsync/rsync/rsync -r --relative --no-implied-dirs src/./a/b/c dest/
rsync: recv_generator: mkdir "/home/matt/test/skip-below/dest/a/b"
failed: No such file or directory (2)
rsync: recv_generator: mkdir "/home/matt/test/skip-below/dest/a/b/c"
failed: No such file or directory (2)
*** Skipping any contents from this failed directory ***
rsync error: some files could not be transferred (code 23) at
main.c(990) [sender=3.0.0cvs]

I think rsync should report the root of the problem, namely

mkdir "/home/matt/test/skip-below/dest/a" failed: Permission denied (13) ,

not the obvious consequence that subdirectories cannot be created.  A
convenient way to accomplish this is to change create_directory_path
in util.c to return the first time mkdir fails, leaving fname
truncated to the name of the failed directory.  (Of course, this
unusual behavior should be documented in the comment!)  Then the error
message would have both the correct directory and the correct errno.
But is it safe to mutate recv_generator's fname?

Wayne: I noticed another possible bug.  Unless I have overlooked
something, recv_generator skips all files between a failed directory
and the next entry whose depth is at most that of the failed
directory.  This is wrong in the case of --relative --no-implied-dirs
because the file list might contain "bar" followed by "baz/foo", and
rsync would skip "baz/foo" after failing to create "bar" even though
"baz/foo" is not inside "bar".


More information about the rsync mailing list