emacs-devel
[Top][All Lists]
Advanced

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

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


From: Francesco Potorti`
Subject: Re: Dangerous: delete-file deletes current directory as root!!
Date: Sat, 12 Oct 2002 01:56:49 +0200

> 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 ?

Definitely the second one.

While unlink(1) is a different command from rm(1), and is used only on
special occasions, delete-file is the only command used to remove a
file, and it should behave just like rm(1) does.  As an added benefit,
delete-file behaves just like rmdir(1), which is fine, as it is not
dangerous, since it acts on empty directories only.  But there is not
reason whatsoever why delete-file should behave like unlink(1).

> 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.

I really mean it, but that's not a reason why I should ruin my file
system by simply making a trivial mistake, that is:

M-x delete-file RET

or worse, as it happened to me:

M-x <up> RET

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

It should be no more dangerous than running a shell as root.  In fact,
it is generally less dangerous, as Emacs usually does checks before
overwriting files and the like.  The way it behaves now on Sun, or at
least under that version of OS, is certainly more dangerous, for no
added benfit.




reply via email to

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