unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Francesco Potorti` <pot@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Dangerous: delete-file deletes current directory as root!!
Date: Sat, 12 Oct 2002 01:56:49 +0200	[thread overview]
Message-ID: <E1809eD-00052o-00@pot.cnuce.cnr.it> (raw)
In-Reply-To: <200210111932.g9BJWc116729@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu)

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

  parent reply	other threads:[~2002-10-11 23:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-11  4:41 [root@mailserver.adm.unipi.it: Dangerous: delete-file deletes current directory as root!!] Richard Stallman
2002-10-11 19:32 ` Dangerous: delete-file deletes current directory as root!! Stefan Monnier
2002-10-11 19:44   ` Kai Großjohann
2002-10-11 23:56   ` Francesco Potorti` [this message]
2002-10-12 18:24     ` Stefan Monnier
2002-10-13 17:20       ` Francesco Potorti`
2002-10-13 22:47       ` Richard Stallman
2002-10-12 15:45   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1809eD-00052o-00@pot.cnuce.cnr.it \
    --to=pot@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).