Re: rmdir of one's pwd (was Re: rmdir of a busy directory)

Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
13 Feb 1999 04:03:14 +0100


Linus Torvalds <torvalds@transmeta.com> writes:

|> On 12 Feb 1999, Andreas Schwab wrote:
|>
|> > |> + if (dentry == current->fs->pwd)
|> > |> + return -EINVAL;
|> > |> +
|> > |> if (!dir->i_op || !dir->i_op->rmdir)
|> > |> return -EPERM;
|> >
|> > This patch is wrong, it also forbids `rmdir ../foo'. Only a path ending
|> > in '.' is special. Think about it: to find out the real name of the entry
|> > to unlink you'll have find its link in the parent directory. With `.' you
|> > simply don't have enough information about what to unlink.
|>
|> Actually, you do.

Yes. I should have added `except when you have Linux' clever dentries'.

|> Show me POSIX or other standards that say that you can't do it, and I
|> guess I have to work around a standards problem, but right now I say that
|> if programs ask for 'rmdir(".")', then they had better get it. I don't
|> think the OS should second-guess anybody.

I agree with that. IMHO the fixinc script should be fixed.

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/