Subject: Re: wierd behaviour of mkdir(2)
To: None <>
From: ITOH Yasufumi <>
List: tech-kern
Date: 10/20/2000 15:53:52
In article <> writes:

> On Thu, 19 Oct 2000, Greg A. Woods wrote:
> # > It is an old debate that has no Posixly correct answer, if I recall
> # > right. It is very counterintuitive to allow mkdir to implicitly descend
> # > into the directory it is about to create, and the only reason this
> # > practice is so widespread is that historically System V allowed this
> # > (due to a bug in their namei implementation, to add insult to injury).
> # 
> # NO!  Not a bug -- a very explict design *feature* that's been there
> # since at least v6, if not before!  UTSL!
> open("/some/path/", flags, mode) should still fail, though, if flags
> specifies creation and "/some/path" does not exist, or if it does exist
> as a non-directory.

I don't have the PC (Posixly correct) answer,
but Solaris consistently allows trailing shashes.
I don't like it, of course. :)

                                        BSD	Solaris
mkdir("foo/", 0777)                 	Fail	Succeed
open("bar/", O_WRONLY|O_CREAT, 0777)	Fail	Succeed
% touch file
link("file/", "new1/")              	Fail	Succeed
symlink("file/", "new2/")           	Fail	Succeed
symlink("file/", "new3")            	Succeed	Succeed (symbolic only)
% cat new3                          	Fail	Succeed

Some programs rely on the traditional behavior,
and needed being rewritten for Solaris.  :-(

Just for your information.
ITOH, Yasufumi