Subject: Re: Pathnames with trailing /
To: Greywolf <greywolf@starwolf.com>
From: Greg A. Woods <woods@weird.com>
List: tech-kern
Date: 09/09/2003 14:42:24
[ On Monday, September 8, 2003 at 12:41:26 (-0700), Greywolf wrote: ]
> Subject: Re: Pathnames with trailing /
>
> I think that what they did actually makes sense.

There's no sense in any system call ever automatically munging what the
user explicitly specified, least of all anything to do with the
filesystem.

Automatically appending a "." filename to a pathname just because
there's an extra separator character on the end is downright nasty and
has lead to all sorts of nasty fallout, most of which was probably
unexpected by the folks who first implemented it.

> What's a "traditional system" anymore, Greg?  There is "traditional
> behaviour"

How about almost _EVERY_ non-*BSD system in existence.

Let's ignore POSIX for the moment and just consider that *BSD is way out
on a shaky creaky limb here.

> GAW> filename "." has been appended to the pathname and yet that's exactly
> GAW> the choice that was made for *BSD.
> 
> Why is this the worst possible thing to do?  Why does it not make sense?

The kernel should never ever make any assumptions about what the user
specified.  Returning an error when trailing slashes are present would
be better than changing the pathname by appending a new filename to the
end of it.  What the kernel is doing now is wrong.

> To look at it visually, it makes *perfect* sense.

If you think it makes sense then you don't understand the difference
between a separator token and something that's actually a part of the
filename.  You need to learn to think of pathname separators as just
being another kind of whitespace -- but in this case one that doesn't
need quoting in programming languages (like shell) which use the other
ASCII whitespace characters for their token separators.

> Reversion to tradition == de-evolution.

No it definitely is not "de-evolution".  It's simply returning to the
same sane behviour every other unix-like system on the planet implements.

> Personally, the fact that "touch foo/", (for any nonexistent "foo") works
> violates the Principle of Least Surprise, from my point of view.

If you stop thinking of the "/" as part of the filename and instead
simply learn to look at it as a separator similar to whitespace then
you'll stop making that mistake.

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>