rename(2) errno processing

Jeff Fellin jkf at research.att.com
Thu Sep 23 07:20:16 MDT 2010


Hello,
I've been porting rsync-3.0.7 to run on UWIN, an AT&T Labs open source project, supporting a Unix environment on Windows. The code configured easily and compiled without any modifications or ifdef's added to the code.

The backup test was failing because it didn't create a subdirectory. In tracing the code I realized the problem was in robust_move() in backup.c. UWIN returns ENOTDIR, when the rename(2) is called when a directory component is not in the new pathname. According to the Open Group website this is a valid errno value. The code in robust_move() only checked for ENOENT. When I added checking for ENOTDIR, the backup test passes.

I suggest changing lines 192 and 264 of backup.c from
      if (errno == ENOENT && make_bak_dir(dst) == 0) {
to 
      if ((errno == ENOENT || errno == ENOTDIR) && make_bak_dir(dst) == 0) {

to conform to the POSIX specification of rename(2) error returns.

Thank you
Jeff Fellin
AT&T Labs
180 Park Ave
Florham Park, NJ


More information about the rsync mailing list