bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: [bug #6047] rm -f "" prints diagnostic message under the Hurd]


From: Marcus Brinkmann
Subject: Re: [Fwd: [bug #6047] rm -f "" prints diagnostic message under the Hurd]
Date: Thu, 29 Apr 2004 12:36:55 +0200
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Thu, 29 Apr 2004 12:32:35 +0300,
Ognyan Kulev wrote:
> The following shell commands (that end up using dir_rename) give other 
> errors, but C program that uses ANSI function rename() gives EINVAL:
> 
> mv x ""                               here "" is recognized as "."
>                               and mv complains
> mv "" x                               here stat("") gives ENOENT
>                               and we don't reach dir_rename
> 
> I would like to make a patch.  But first, what are the sensible errors? 
>   Here is what I think:
> 
> dir_link("x", "") returns EINVAL
> dir_unlink("") returns ENOENT
> dir_mkdir("") returns EINVAL
> dir_rmdir("") returns ENOENT
> dir_rename("x", "") returns EINVAL
> dir_rename("", "x") returns ENOENT
> 
> mv x "" should give EINVAL, I think.  I suppose this is for the 
> coreutils developers.

You must be careful here.  The main thing that matters for us is the
POSIX interface here.  The coreutils already behave correctly, unless
there is a bug that also shows on other POSIX systems.  The dir_* are
not specified, but we can specify them.  So, we can decide if we want
to use EINVAL or ENOENT in them.  I think that there is a consistent
pattern to make them behave like the equivalent POSIX functions, but I
am not sure it is completely followed.

In any case, how rename(), unlink() etc should behave is defined by
POSIX.  I only checked unlink(), mkdir() and rename() (not rmdir and
link), and for those ENOENT is required.  You may want to check the
others.

Thanks,
Marcus





reply via email to

[Prev in Thread] Current Thread [Next in Thread]