All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug in unlink error return
@ 2001-05-17 11:26 Andries.Brouwer
  2001-05-17 11:45 ` Alan Cox
  2001-05-17 12:29 ` Alexander Viro
  0 siblings, 2 replies; 4+ messages in thread
From: Andries.Brouwer @ 2001-05-17 11:26 UTC (permalink / raw)
  To: linux-kernel, viro

Someone complained a moment ago about the error return in unlink.
And indeed, it used to be correct but since 2.1.132 we return a
buggy (or at least non-POSIX) error for unlink(directory).

Just changed the man page to say

unlink(2)
...
       EPERM  The system does not allow unlinking of directories,
              or unlinking  of  directories  requires  privileges
              that  the  current  process doesn't have.  (This is
              the POSIX prescribed error return.)

       EISDIR pathname refers to a directory.  (This is the  non-
              POSIX value returned by Linux since 2.1.132.)
...

Probably this should be fixed again, both in 2.2 and 2.4.
2.0 is still correct (I checked only ext2).

Andries


[The EISDIR is correct for rename(), and the cleanup that
made a nice uniform may_delete() in namei.c introduced this bug.
The very simple but slightly ugly fix is to write (in vfs_unlink)
	error = may_delete(dir, dentry, 0);
	if (error == -EISDIR)
		error = -EPERM;
]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Bug in unlink error return
@ 2001-05-17 12:46 Andries.Brouwer
  0 siblings, 0 replies; 4+ messages in thread
From: Andries.Brouwer @ 2001-05-17 12:46 UTC (permalink / raw)
  To: Andries.Brouwer, viro; +Cc: linux-kernel

> IMO that's the case of POSIX being misapplied. Rationale:
> * historically, ...

Yes, I know all about that.
Nevertheless the facts are here:

       EPERM  The system does not allow unlinking of directories,
              or unlinking  of  directories  requires  privileges
              that  the  current  process doesn't have.  (This is
              the POSIX prescribed error return.)

       EISDIR pathname refers to a directory.  (This is the  non-
              POSIX value returned by Linux since 2.1.132.)

At first I wrote "buggy" instead of "non-POSIX", but in fact
I prefer EISDIR myself. On the other hand, Linux follows POSIX,
even in the cases where we don't like POSIX very much.

Btw - this change in 2.1.132 actually broke programs, so
at that time is was really the introduction of a bug.

Andries

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-17 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-17 11:26 Bug in unlink error return Andries.Brouwer
2001-05-17 11:45 ` Alan Cox
2001-05-17 12:29 ` Alexander Viro
  -- strict thread matches above, loose matches on Subject: below --
2001-05-17 12:46 Andries.Brouwer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.