From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andre Spiegel Newsgroups: gmane.emacs.devel Subject: Re: VC, read-only buffers for writable files Date: 22 Oct 2002 16:35:55 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <1035297355.2276.58.camel@eagle> References: <200210221331.g9MDV3n21931@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1035297457 1957 80.91.224.249 (22 Oct 2002 14:37:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 22 Oct 2002 14:37:37 +0000 (UTC) Cc: Stefan Monnier Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1840A1-0000V1-00 for ; Tue, 22 Oct 2002 16:37:33 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 1840BG-0002Q5-00 for ; Tue, 22 Oct 2002 16:38:50 +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 18408p-0006tl-00; Tue, 22 Oct 2002 10:36:19 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18407d-0006N4-00 for emacs-devel@gnu.org; Tue, 22 Oct 2002 10:35:05 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18407Y-0006El-00 for emacs-devel@gnu.org; Tue, 22 Oct 2002 10:35:03 -0400 Original-Received: from pd9517786.dip.t-dialin.net ([217.81.119.134] helo=localhost) by monty-python.gnu.org with esmtp (Exim 4.10) id 18407Y-0006E2-00 for emacs-devel@gnu.org; Tue, 22 Oct 2002 10:35:00 -0400 Original-Received: from spiegel by localhost with local (Exim 3.36 #1 (Debian)) id 18408X-0001DT-00; Tue, 22 Oct 2002 16:36:01 +0200 Original-To: emacs-devel@gnu.org In-Reply-To: <200210221331.g9MDV3n21931@rum.cs.yale.edu> X-Mailer: Ximian Evolution 1.0.8 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:8652 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:8652 On Tue, 2002-10-22 at 15:31, Stefan Monnier wrote: > Currently VC sometimes makes a file read-only because it thinks it's > better that way for the user. More specifically, it makes it read-only > if the file seems to be locked by another user. I have talked this over with Stefan several times, and we have reached no agreement. I'll be happy to let the general public (or Richard, for that matter :-) decide. > This special behavior used to apply to SCCS, RCS and CVS under Emacs-20 > and was silently changed in Emacs-21 to only apply to RCS and SCCS (it was > changed as a side effect of another change). Nobody complained about > this change and I think we should go further and remove this hack > altogether so it doesn't aply to RCS and SCCS either. The behavior wasn't changed accidentally for CVS. There are no locks under CVS, and Emacs-21 handles that correctly by not assuming that a file could be "locked" by anybody. RCS and SCCS do have locks, and Emacs-21 deliberately chooses to enforce the locking. This is not a "hack". If people don't want that, so be it, then we'll change it. Here is the relevant portion of code from vc-hooks.el, since the comments may make it clearer to everybody. ;; If the file is locked by some other user, make ;; the buffer read-only. Like this, even root ;; cannot modify a file that someone else has locked. (and (equal file (buffer-file-name)) (stringp (vc-state file)) (setq buffer-read-only t)) ;; 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)))