From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Francesco Potorti` Newsgroups: gmane.emacs.devel Subject: Re: Dangerous: delete-file deletes current directory as root!! Date: Sat, 12 Oct 2002 01:56:49 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: References: <200210111932.g9BJWc116729@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1034380618 18886 127.0.0.1 (11 Oct 2002 23:56:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 11 Oct 2002 23:56:58 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1809eL-0004uU-00 for ; Sat, 12 Oct 2002 01:56:57 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 180ATa-0000v5-00 for ; Sat, 12 Oct 2002 02:49:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 1809ec-0006Zg-00; Fri, 11 Oct 2002 19:57:14 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 1809eI-0006DB-00 for emacs-devel@gnu.org; Fri, 11 Oct 2002 19:56:54 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 1809eG-00068G-00 for emacs-devel@gnu.org; Fri, 11 Oct 2002 19:56:53 -0400 Original-Received: from pot.cnuce.cnr.it ([146.48.83.182]) by monty-python.gnu.org with esmtp (Exim 4.10) id 1809eF-000688-00 for emacs-devel@gnu.org; Fri, 11 Oct 2002 19:56:51 -0400 Original-Received: from pot by pot.cnuce.cnr.it with local (Exim 3.36 #1 (Debian)) id 1809eD-00052o-00; Sat, 12 Oct 2002 01:56:49 +0200 Original-To: Stefan Monnier In-reply-to: <200210111932.g9BJWc116729@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu) X-fingerprint: 4B2 6187 5C3 D6B1 2E31 7666 9DF 2DC9 BE21 6115 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:8537 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:8537 > 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 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.