possible typo/bug in receiver.c

Dave Dykstra dwd at drdykstra.us
Mon Jan 20 23:35:00 EST 2003

On Sat, Jan 18, 2003 at 12:25:05AM -0800, Wayne Davison wrote:
> 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.
> ...wayne..

I removed the error check that skipped the creation of the directory,
just a piece of the code that was added in version 1.32.  It's pretty
clear to me that it was just an oversight, because Tridge also modified
the dead code leg.

- Dave

More information about the rsync mailing list