Dmytro Taranovsky <[EMAIL PROTECTED]> writes:

> As far as I know, mkdir prints "No such file or directory" only when the
> parent directory does not exist

Only if by "not exist" you mean "mkdir() fails with errno==ENOENT",
which is a bit circular.  For example:

   $ rm -f x y
   $ ln -s x y
   $ ls -l x y
   ls: x: No such file or directory
   lrwxrwxrwx  1 eggert eggert 1 2004-09-07 19:33 y -> x
   $ mkdir y/d
   mkdir: cannot create directory `y/d': No such file or directory

Here, a more accurate error message would be something like "y exists,
but it's a dangling symbolic link, so the name y/d doesn't work".
That'd take a bit of work to generate.  Or how about this one:

   $ rm -f x
   $ mkdir x/y/z
   mkdir: cannot create directory `x/y/z': No such file or directory

Here the real problem is that x doesn't exist, not that x/y doesn't
exist; and mkdir would have to root around and discover this in order
to avoid the misleading error message "x/y doesn't exist".

Here's another one:

   $ mkdir ''
   mkdir: cannot create directory `': No such file or directory

A different case entirely.  There are probably other cases but I hope
you get the idea.  Fixing all this to produce a "nice" message, that
is reliable in general, would be a bit of work.

The fundamental problem here is that errno==ENOENT is overloaded,
but this is more the fault of mkdir() than of the "mkdir" command.


_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to