Re: rename(2) errno processing

2010-10-14 Thread Matt McCutchen
On Sat, 2010-09-25 at 22:52 -0400, Matt McCutchen wrote:
> I have filed a request to clarify the meaning of ENOTDIR for all
> syscalls:
> 
> http://austingroupbugs.net/view.php?id=324

The interpretation of ENOTDIR as referring only to existing
non-directory files has been accepted, so the UWIN behavior is
non-conforming and no change to rsync is necessary.  (Assuming I've
understood the original issue correctly.)

-- 
Matt

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: rename(2) errno processing

2010-09-25 Thread Matt McCutchen
On Sat, 2010-09-25 at 11:46 -0700, Wayne Davison wrote:
> On Sat, Sep 25, 2010 at 9:38 AM, Matt McCutchen wrote:
> 
> > POSIX is unclear about whether walking a path where a non-final component
> > is missing is allowed to return ENOTDIR.
> >
> 
> Yes, posix may be unclear, but I don't think this alternate interpretation
> is useful when a much better interpretation exists.

It's not our decision which interpretation of POSIX is correct; we would
have to request an official clarification.  But I just noticed that the
general description of ENOTDIR states the Linux interpretation:

[ENOTDIR]
Not a directory. A component of the specified pathname exists,
but it is not a directory, when a directory was expected.

I have filed a request to clarify the meaning of ENOTDIR for all
syscalls:

http://austingroupbugs.net/view.php?id=324

In any event, it is your (Wayne's) decision whether it's a goal for
rsync to work on all POSIX-conforming systems, but if you are deciding
"no", please be clear.

-- 
Matt


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: rename(2) errno processing

2010-09-25 Thread Wayne Davison
On Sat, Sep 25, 2010 at 9:38 AM, Matt McCutchen wrote:

> POSIX is unclear about whether walking a path where a non-final component
> is missing is allowed to return ENOTDIR.
>

Yes, posix may be unclear, but I don't think this alternate interpretation
is useful when a much better interpretation exists.

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: rename(2) errno processing

2010-09-25 Thread Matt McCutchen
On Sat, 2010-09-25 at 09:09 -0700, Wayne Davison wrote:
> I believe that ENOTDIR should only be returned if some component in the path
> exists but is not a directory.  If the path is not fully there, it should
> instead return ENOENT.

POSIX is unclear about whether walking a path where a non-final
component is missing is allowed to return ENOTDIR.  IIUC, UWIN has taken
the interpretation that it is allowed, and does so.  See my other
message:

https://lists.samba.org/archive/rsync/2010-September/025606.html

> For 3.0.x, I don't want to treat ENOTDIR as a valid
> return because it is indicating a path failure that the 3.0.x code cannot
> handle (since it doesn't try to fix conflicting backup paths).  The 3.1.0
> code (in git) validates the backup paths to ensure that any conflicting bits
> turn into dirs (e.g. it will avoid an accidental use of a symlink as a dir
> in the path), and I'd imagine that this code should work fine in your
> environment.

Maybe so for the backup code, but I presume that the issue affects all
places where rsync checks for ENOENT from any syscall, not just
"rename".

-- 
Matt

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: rename(2) errno processing

2010-09-25 Thread Wayne Davison
On Thu, Sep 23, 2010 at 6:20 AM, Jeff Fellin  wrote:

> 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.


I believe that ENOTDIR should only be returned if some component in the path
exists but is not a directory.  If the path is not fully there, it should
instead return ENOENT.  For 3.0.x, I don't want to treat ENOTDIR as a valid
return because it is indicating a path failure that the 3.0.x code cannot
handle (since it doesn't try to fix conflicting backup paths).  The 3.1.0
code (in git) validates the backup paths to ensure that any conflicting bits
turn into dirs (e.g. it will avoid an accidental use of a symlink as a dir
in the path), and I'd imagine that this code should work fine in your
environment.

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

rename(2) errno processing

2010-09-23 Thread Jeff Fellin

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
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html