From: Glenn Morris <rgm@gnu.org>
To: emacs-devel@gnu.org
Subject: vc-mode-line ancient, root-specific code for buffer-read-only
Date: Tue, 18 Dec 2018 23:49:39 -0500 [thread overview]
Message-ID: <irtvjam87w.fsf@fencepost.gnu.org> (raw)
Hi,
vc-mode-line contains this:
;; If the user is root, and the file is not owner-writable,
;; then pretend that we can't write it
;; even though we can (because root can write anything).
;; This way, even root cannot modify a file that isn't locked.
(and (equal file buffer-file-name)
(not buffer-read-only)
(zerop (user-real-uid))
(zerop (logand (file-modes buffer-file-name) 128))
(setq buffer-read-only t)))
Some version of this has been present since at least 1996.
It is buggy in that it has a race condition: (file-modes buffer-file-name)
will return nil if the file has been deleted, and logand will error.
Eg this happens if you run make lisp/vc/vc-bzr-tests as root, which is
presumably what prompted Debian to disable one of the tests
https://sources.debian.org/patches/emacs/1:26.1+1-1/0010-Mark-vc-bzr-test-fauilt-bzr-autoloads-as-unstable-fo.patch/
I would like to suggest just removing that vc-mode-line code.
It's for locking VCS, is buggy, and doesn't even make sense.
root cannot "write anything", unless we are concerned with odd cases
like a file being writable by other but not owner. Ie locked files would
be marked read-only for root anyway.
next reply other threads:[~2018-12-19 4:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 4:49 Glenn Morris [this message]
2018-12-19 6:16 ` vc-mode-line ancient, root-specific code for buffer-read-only Paul Eggert
2018-12-19 9:18 ` Andreas Schwab
2018-12-19 18:10 ` Glenn Morris
2018-12-19 21:23 ` Stefan Monnier
2018-12-19 22:41 ` Paul Eggert
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=irtvjam87w.fsf@fencepost.gnu.org \
--to=rgm@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).