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: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files] Date: Sun, 20 Nov 2005 18:46:50 +0100 Message-ID: <1132508810.3050.102.camel@localhost> References: <1132399024.3050.90.camel@localhost> <87psov6yo6.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 1132508998 21071 80.91.229.2 (20 Nov 2005 17:49:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 20 Nov 2005 17:49:58 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 20 18:49:56 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EdtId-0008CR-3S for ged-emacs-devel@m.gmane.org; Sun, 20 Nov 2005 18:48:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EdtIc-0006fl-80 for ged-emacs-devel@m.gmane.org; Sun, 20 Nov 2005 12:48:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EdtHm-0006SM-Qd for emacs-devel@gnu.org; Sun, 20 Nov 2005 12:47:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EdtHj-0006PN-0z for emacs-devel@gnu.org; Sun, 20 Nov 2005 12:47:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EdtHh-0006P0-BC for emacs-devel@gnu.org; Sun, 20 Nov 2005 12:47:26 -0500 Original-Received: from [193.113.160.39] (helo=mail.o2.co.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EdtHc-00089R-V2; Sun, 20 Nov 2005 12:47:21 -0500 Original-Received: from [84.191.108.55] (84.191.108.55) by mail.o2.co.uk (7.0.045) id 436BC02F001EB6D0; Sun, 20 Nov 2005 17:47:17 +0000 Original-To: Stefan Monnier In-Reply-To: <87psov6yo6.fsf-monnier+emacs@gnu.org> X-Mailer: Evolution 2.2.3 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:46346 Archived-At: On Sun, 2005-11-20 at 12:02 -0500, Stefan Monnier wrote: > > The only solution I can think of would be to have a new > > file-handler-sensitive operation (file-login-name FILE) which returns > > the name of the user under which Emacs accesses the given FILE. For > > local files, that would be equivalent to user-login-name, for remote > > files it would be the name of the remote user, or "root" if Tramp sudo:: > > is involved. > > We could try and use (process-file "whoami") or (process-file "id"). Very good idea. I would wrap it so that it calls the external program only for Tramp files, and uses user-login-name for local files. A related operation, also used in VC, is to find a user's login name, given the uid of that user. In the local case, Emacs does it via (user-login-name UID), which is implemented as getpwuid(). How would you do that for a remote file? I'm currently baffled as to how I could get that information at the shell level, sans grepping /etc/passwd of course.