Subject: Re: mkdir with trailing / (patch proposed)
To: Jed Davis <>
From: Allen Briggs <>
List: tech-userlevel
Date: 04/28/2002 21:39:53
On Sun, Apr 28, 2002 at 09:32:26PM -0400, Jed Davis wrote:
> I can "mkdir foo/" fine, but if I access mkdir(2) more directly, by
> e.g.  perl -e 'mkdir "foo/" or die $!' (I assume this would also work
> directly from C), it dies on ENOENT ("No such file or directory").
> I assume that's what they mean.

Yes.  I think the "logic" says, "Pathnames ending in slash are
implicitly also ending in `dot'"  So mkdir("foo/") is the same as
mkdir("foo/."), which doesn't make a lot of sense since one doesn't
make "." or "..".  The ENOENT comes from the check for "foo", which

While I don't think it's right for applications to expect mkdir("foo/")
(or rmdir("foo/"), for that matter) to work, I wouldn't mind seeing it
accept that case under the "be liberal in what you accept" policy.  I
do _not_ want to see a kernel printf() as someone suggested.

Personally, I'm ambivalent, but I haven't been bitten by it yet...  :-)


 Allen Briggs               Quality NetBSD CDs, Sales, Support, Service
NetBSD development for Alpha, ARM, M68K, MIPS, PowerPC, SuperH, XScale, etc...