[Top][All Lists]

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

Re: Dangerous: delete-file deletes current directory as root!!

From: Stefan Monnier
Subject: Re: Dangerous: delete-file deletes current directory as root!!
Date: Fri, 11 Oct 2002 15:32:38 -0400

> In GNU Emacs 21.2.1 (sparc-sun-solaris2.8, X toolkit)
> I am not knowledgeable about this platform, but here Emacs has a
> serious and dangerous bug.  When running as root (did not try as a
> normal user) if one does:
> M-x delete-file RET
> Emacs deletes the current directory!

Hmmm, the Single Unix Specification V2 says about unlink:

   The path argument must not name a directory unless the process
   has appropriate privileges and the implementation supports using
   unlink() on directories.

Now, I'm not sure what `delete-file' should do.  Should it mimic `unlink'
or should it first check that it is not called on a directory ?

Since the check would only be needed for `root' and since I don't
think that people should be running Emacs under root unless they really
mean it, I think the current code is fine.

Maybe we should pop up a warning message when Emacs is started
as root, reminding them that it can be dangerous ?


reply via email to

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