Subject: Re: mkdir with trailing / (patch proposed)
To: Bill Studenmund <wrstuden@netbsd.org>
From: Matthew Orgass <darkstar@pgh.net>
List: tech-kern
Date: 05/05/2002 16:52:12
  Well, I just took a look at SUSv3 (a.k.a. IEEE 1003.1-2001, see
www.opengroup.org/austin).  It seems that they have resolved the ambiguity
in the specification of trailing slashes by doing something completely
different.  They specify that trailing slashes are to be intrepreted as if
there was a trailing '/.'.  In the rationale they claim that this simply
resolves the ambiguity and does not break conforming application, however
it mandates an extra directory lookup which breaks compatability with
previous POSIX standards and all previously conforming implementations
(i.e. rmdir("foo/") no longer works).  The fact that they seem to be
unaware of this incompatability and that this was a late revision makes me
wonder if it will change again soon.

  Given this situation, it may be prudent to wait until after the 1.6
branch before making any changes to the native behavior (if there was any
chance of getting it in before then anyway), especially since the current
NetBSD behavior is the closest implementation to what is specified that is
compatable with past standards and thus might wind up being specified as
the correct behavior.  On the other hand, it appears that every other
modern OS allows mkdir("foo/") to create a directory.  The compatabaility
code at least should be updated.

  So, what does NetBSD want to do with trailing slashes in native code?
And what (if anything) should be done to bring this situation to the
attention of the Austin folks?

  I'd be happy to provide a revised patch once its decided what should be
done.  My previous patch was incorrect in that it allowed pathnames with a
trailing slash to refer to symlinks (under emulation only), which is
forbidden.

Matthew Orgass
darkstar@pgh.net