From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andre Spiegel Newsgroups: gmane.emacs.devel Subject: Re: Tramp and VC integration: "calling user" Date: Thu, 31 Mar 2005 18:54:34 +0200 Message-ID: <1112288074.17621.23.camel@localhost> References: <87is386k0h.fsf@emptydomain.de> <87mzskym6e.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1112288387 11220 80.91.229.2 (31 Mar 2005 16:59:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 31 Mar 2005 16:59:47 +0000 (UTC) Cc: Kai Gro?johann , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 31 18:59:42 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DH30G-0006v7-Ml for ged-emacs-devel@m.gmane.org; Thu, 31 Mar 2005 18:58:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DH3H0-0002fR-0q for ged-emacs-devel@m.gmane.org; Thu, 31 Mar 2005 12:16:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DH3GM-0002CG-G3 for emacs-devel@gnu.org; Thu, 31 Mar 2005 12:15:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DH3GH-00028H-Fi for emacs-devel@gnu.org; Thu, 31 Mar 2005 12:15:19 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DH3GH-00024y-6i for emacs-devel@gnu.org; Thu, 31 Mar 2005 12:15:17 -0500 Original-Received: from [193.113.160.39] (helo=mail.o2.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DH2wR-00012u-LC for emacs-devel@gnu.org; Thu, 31 Mar 2005 11:54:47 -0500 Original-Received: from [212.202.180.252] (212.202.180.252) by mail.o2.co.uk (7.0.042) id 4240277700132E28; Thu, 31 Mar 2005 17:54:43 +0100 Original-To: Stefan Monnier In-Reply-To: <87mzskym6e.fsf-monnier+emacs@gnu.org> X-Mailer: Evolution 2.0.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:35432 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35432 On Thu, 2005-03-31 at 08:34 -0500, Stefan Monnier wrote: > Could you remind me why file-writable-p can't be used? The conditions "file is writable by the calling user" and "file is locked by the calling user" are not equivalent. They can differ if somebody modifies file permissions deliberately (I've seen this happen at most sites where RCS is used). They also differ if RCS is used with non-strict locking. VC has lots of code to detect mismatches between the two conditions, because they do occur all the time in real world situations. There is also a special user option, vc-mistrust-permissions, which does precisely what the name suggests. So, in short, it is not possible to use file-writable-p. There needs to be a way, as Kai described, to compare the name of the calling user and the name of the locking user as per the RCS master file. I think the suggestion no. 2, file-calling-user, is best. Conceptually, it is something like "user-login-name relative to a given file". For files on the local machine, it is the name of the user running Emacs. For files on a remote machine, it is the name of the user under which the files are accessed (the login account at the remote machine). Perhaps it would be worthwhile to add an optional FILE argument to user-login-name, but it already has an optional argument, UID, so perhaps a new function, file-calling-user, as Kai suggests, is best.