Subject: Re: Linux emulation and mkdir with trailing /
To: None <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 09/24/2000 14:24:08
[ On Saturday, September 23, 2000 at 17:11:30 (-0400), Bill Sommerfeld wrote: ]
> Subject: Re: Linux emulation and mkdir with trailing /
> my understanding is that the interpretation of '/' at the end of a
> pathname has differed between BSD and SysV; BSD has traditionally
> interpreted it as the same as 'foo/.' while at least some SysV-based
> systems have interpreted it as the same as 'foo'.
V6 & V7 & 32V & SysIII included this little loop twice in namei() [all
these releases contain remarkably identical code]:
while(c == '/')
c = (*func)();
(where `func' is "a function called to get the next char of name")
John Lions gives the following explanation:
Multiple slashes are acceptable! (i.e. "////a///b/" is the same
The second occurance would appear to be the one that eats up any
trailing slashes. This does not appear to be done in 4.3BSD for reasons
I cannot fathom, though I may be simply missing some subtlety in my
quick and naive attempt at a code walkthrough. (if I'm right was it a
simple omission in the rewrite?).
I don't ever recall any difference in behaviour of any SysV -- I'm
reasonably sure they all honoured the original Unix behaviour. In fact
I remeber tripping over related "bugs" in BSD, but not the other way
In NetBSD it would appear that there is code to do this, though it may
not be happening at the right point to have the effect I think it does.
In any case I think *BSD should definitely take on the behaviour of
traditional Unix and do as Lions comment says. I cannot think of
anything serious that would break, but I can thing of many things that
would be fixed, not the least of which would be the elimination of any
need for `special' handling of pathnames in programs that call mkdir(2).
BTW, I think that doing this in a `POSIX' compatability routine would be
absolutely wrong. If someone wants to wrap the kernel code in `#ifdef
POSIX' then that might be OK, but in the case of NetBSD in particular I
think `#define POSIX 1' is strongly in order!
Greg A. Woods
+1 416 218-0098 VE3TCP <firstname.lastname@example.org> <robohack!woods>
Planix, Inc. <email@example.com>; Secrets of the Weird <firstname.lastname@example.org>