all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* vc-mode-line ancient, root-specific code for buffer-read-only
@ 2018-12-19  4:49 Glenn Morris
  2018-12-19  6:16 ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2018-12-19  4:49 UTC (permalink / raw)
  To: emacs-devel


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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-19 22:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19  4:49 vc-mode-line ancient, root-specific code for buffer-read-only Glenn Morris
2018-12-19  6:16 ` 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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.