From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: vc-mode-line ancient, root-specific code for buffer-read-only Date: Tue, 18 Dec 2018 23:49:39 -0500 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1545194923 31342 195.159.176.226 (19 Dec 2018 04:48:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Dec 2018 04:48:43 +0000 (UTC) User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 19 05:48:39 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZTmd-0007zn-Ky for ged-emacs-devel@m.gmane.org; Wed, 19 Dec 2018 05:48:35 +0100 Original-Received: from localhost ([::1]:57626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZTok-00029d-1q for ged-emacs-devel@m.gmane.org; Tue, 18 Dec 2018 23:50:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZTnh-0001Pv-BC for emacs-devel@gnu.org; Tue, 18 Dec 2018 23:49:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZTng-00038b-BA for emacs-devel@gnu.org; Tue, 18 Dec 2018 23:49:41 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZTng-00038U-7F for emacs-devel@gnu.org; Tue, 18 Dec 2018 23:49:40 -0500 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gZTng-0006LB-2V; Tue, 18 Dec 2018 23:49:40 -0500 X-Spook: Zachawi Taliban Saudi Arabia Lon Horiuchi MP5K-SD X-Ran: ~>}4D=hhx>ChX(R0y;ZUXTv,.QCSg4Ref("Y?zD]vX"lu)bIQs0<~&{,NcO@14M-1+G?2y X-Hue: brightblue X-Attribution: GM X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:231915 Archived-At: 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.