possible typo/bug in receiver.c
wayned at users.sourceforge.net
Sat Jan 18 08:26:00 EST 2003
On Fri, Jan 17, 2003 at 11:39:31PM -0800, Craig Barratt wrote:
> If mkstemp() fails (for various reasons, including the directory not
> existing) then fd == -1. So the first if () executes, which flushes
> the data and does a continue. So the next two if () statements will
> never execute.
Good catch. The code got tweaked into this form in version 1.32 when it
was changed from a set of calls (using do_mktemp() and do_open()) into a
single call (using just do_mkstemp()). At that point the new (simpler)
error-check section got added, and it made it impossible to get down to
the older section.
> Is rsync meant to create deep directories that don't exist?
Not usually. In -R mode, it sends implied directories for the files, so
it should be the case that the directories are normally created already.
I find it interesting that this old code exists because there has been a
lot of talk about the sending of implied directories (and an option to
turn this off). If we put this code back the way it was back in 2001,
then the newly suggested --no-implied-dirs option would not cause rsync
to fail if a deep file didn't have a directory yet -- rsync would just
create the intervening directories. I'm not sure if I want it to do
that or not at the moment.
More information about the rsync