From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Dangerous: delete-file deletes current directory as root!!
Date: Fri, 11 Oct 2002 15:32:38 -0400 [thread overview]
Message-ID: <200210111932.g9BJWc116729@rum.cs.yale.edu> (raw)
In-Reply-To: E17zrbu-00026F-00@fencepost.gnu.org
> 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 ?
Stefan
next prev parent reply other threads:[~2002-10-11 19:32 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 ` Stefan Monnier [this message]
2002-10-11 19:44 ` Dangerous: delete-file deletes current directory as root!! Kai Großjohann
2002-10-11 23:56 ` Francesco Potorti`
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=200210111932.g9BJWc116729@rum.cs.yale.edu \
--to=monnier+gnu/emacs@rum.cs.yale.edu \
--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).