unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
       [not found] <E1EYXgy-0001gS-J5@fencepost.gnu.org>
@ 2005-11-19 11:17 ` Andre Spiegel
  2005-11-20 17:02   ` Stefan Monnier
  2005-11-20 23:23   ` Richard M. Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Andre Spiegel @ 2005-11-19 11:17 UTC (permalink / raw)
  Cc: emacs-devel

On Sat, 2005-11-05 at 18:43 -0500, Richard Stallman wrote:

> [I sent this message three times but my system did not see
> a response.  Did you deal with this?]

Sorry for the delayed response.  This is actually a more fundamental
issue and I'm not sure how to proceed with this.

Here is the problem statement:

> When I want to modify a file owned by root and RCS controlled through the
> tramp sudo:: method, Emacs think it does not have to do the check out and
> triggers a steal-the-lock procedure.

The problem is that VC needs to compare the name of the user holding the
lock on a file to the name of the user that is running Emacs.  (The RCS
master file only contains the name of the locking user, no UID.)  VC
normally compares the name to user-login-name, but this is not correct
when Tramp is involved, because the account at the end of the Tramp
connection might be a different one (not just under the sudo:: method,
other methods can also exhibit this behaviour).

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.

What do you think?

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-19 11:17 ` [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files] Andre Spiegel
@ 2005-11-20 17:02   ` Stefan Monnier
  2005-11-20 17:46     ` Andre Spiegel
  2005-11-20 19:28     ` Eli Zaretskii
  2005-11-20 23:23   ` Richard M. Stallman
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2005-11-20 17:02 UTC (permalink / raw)
  Cc: rms, emacs-devel

> 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").


        Stefan

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 17:02   ` Stefan Monnier
@ 2005-11-20 17:46     ` Andre Spiegel
  2005-11-20 19:03       ` Andreas Schwab
                         ` (2 more replies)
  2005-11-20 19:28     ` Eli Zaretskii
  1 sibling, 3 replies; 10+ messages in thread
From: Andre Spiegel @ 2005-11-20 17:46 UTC (permalink / raw)
  Cc: rms, emacs-devel

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.

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 17:46     ` Andre Spiegel
@ 2005-11-20 19:03       ` Andreas Schwab
  2005-11-20 22:49       ` Stefan Monnier
  2005-11-21  9:53       ` Michael Albinus
  2 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2005-11-20 19:03 UTC (permalink / raw)
  Cc: emacs-devel, Stefan Monnier, rms

Andre Spiegel <spiegel@gnu.org> writes:

> 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?

You can try "getent passwd UID" if it exists.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 17:02   ` Stefan Monnier
  2005-11-20 17:46     ` Andre Spiegel
@ 2005-11-20 19:28     ` Eli Zaretskii
  2005-11-20 22:50       ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2005-11-20 19:28 UTC (permalink / raw)
  Cc: spiegel, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sun, 20 Nov 2005 12:02:59 -0500
> Cc: rms@gnu.org, emacs-devel@gnu.org
> 
> > 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").

Can we assume that these commands are always available on all
supported systems?

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 17:46     ` Andre Spiegel
  2005-11-20 19:03       ` Andreas Schwab
@ 2005-11-20 22:49       ` Stefan Monnier
  2005-11-21 10:11         ` Andre Spiegel
  2005-11-21  9:53       ` Michael Albinus
  2 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2005-11-20 22:49 UTC (permalink / raw)
  Cc: rms, emacs-devel

> A related operation, also used in VC, is to find a user's login name,
> given the uid of that user.

When do we need that?  I thought it was only used on the output of
file-attributes, and so shouldn't be needed now that this operation takes an
`id-format' argument to specifies whether to return uids/gids or
user/group-names.


        Stefan

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 19:28     ` Eli Zaretskii
@ 2005-11-20 22:50       ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2005-11-20 22:50 UTC (permalink / raw)
  Cc: spiegel, emacs-devel

>> We could try and use (process-file "whoami") or (process-file "id").

> Can we assume that these commands are always available on all
> supported systems?

Probably not, but it's not difficult to catch the error and fall back on
the behavior we have now.


        Stefan

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-19 11:17 ` [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files] Andre Spiegel
  2005-11-20 17:02   ` Stefan Monnier
@ 2005-11-20 23:23   ` Richard M. Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Richard M. Stallman @ 2005-11-20 23:23 UTC (permalink / raw)
  Cc: emacs-devel

    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.

    What do you think?

It seems ok to me, provided it is localized and simple enough
that it isn't a risk to install it now.  Would you like to write
the patch?  It would be necessary to change the Lisp manual too.

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 17:46     ` Andre Spiegel
  2005-11-20 19:03       ` Andreas Schwab
  2005-11-20 22:49       ` Stefan Monnier
@ 2005-11-21  9:53       ` Michael Albinus
  2 siblings, 0 replies; 10+ messages in thread
From: Michael Albinus @ 2005-11-21  9:53 UTC (permalink / raw)
  Cc: rms, emacs-devel

Andre Spiegel <spiegel@gnu.org> writes:

> 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.

# touch /tmp/foo; chown UID /tmp/foo

Then you can retrieve the user name via file-attributes, with
ID-FORMAT 'string.

Best regards, Michael.

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

* Re: [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files]
  2005-11-20 22:49       ` Stefan Monnier
@ 2005-11-21 10:11         ` Andre Spiegel
  0 siblings, 0 replies; 10+ messages in thread
From: Andre Spiegel @ 2005-11-21 10:11 UTC (permalink / raw)
  Cc: rms, emacs-devel

On Sun, 2005-11-20 at 17:49 -0500, Stefan Monnier wrote:

> > A related operation, also used in VC, is to find a user's login name,
> > given the uid of that user.
> 
> When do we need that?  I thought it was only used on the output of
> file-attributes, and so shouldn't be needed now that this operation takes an
> `id-format' argument to specifies whether to return uids/gids or
> user/group-names.

Exactly what I was looking for.  I wasn't aware of this id-format
parameter.  Thanks, I'll make the necessary changes.

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

end of thread, other threads:[~2005-11-21 10:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1EYXgy-0001gS-J5@fencepost.gnu.org>
2005-11-19 11:17 ` [Ronan.Keryell@enstb.org: tramp sudo:: and version control on RCS root controlled files] Andre Spiegel
2005-11-20 17:02   ` Stefan Monnier
2005-11-20 17:46     ` Andre Spiegel
2005-11-20 19:03       ` Andreas Schwab
2005-11-20 22:49       ` Stefan Monnier
2005-11-21 10:11         ` Andre Spiegel
2005-11-21  9:53       ` Michael Albinus
2005-11-20 19:28     ` Eli Zaretskii
2005-11-20 22:50       ` Stefan Monnier
2005-11-20 23:23   ` Richard M. Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).