unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ls-lisp and remote files
@ 2003-10-30 20:06 Lars Hansen
  2003-10-30 20:25 ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Hansen @ 2003-10-30 20:06 UTC (permalink / raw)
  Cc: tramp-devel

  I have been working on making ls-lisp work for remote files. To do 
that I have made a Tramp implementation of 
directory-files-and-attributes using perl on the remote machine. This 
works fine except for the translation of UID's and GID's to names. To 
make this translation, ls-lisp calls user-login-name which works in the 
context of the local machine, and that is wrong for remote directories. 
Of cource one could just let ls-lisp check if the directory is remote 
and make no translation if it is. However, I sugest the following:

1. Add an optional parameter ID-NAMES to the lisp functions 
file-attributes and directory-files-and-attributes. When ID-NAMES is 
non-nil, UID and GID is returned as names if possible.

2. Let ls-lisp use this feature to obtain UID and GID names.

I have implemented these change on my own machine (dired.c, lisp.h, 
ls-lisp.el, tramp.el) and it seems to work fine.

I want to ask people what you think about this suggestion.

----------------

One more related thing.
IFAICS it is a bug that the current implementation of ls-lisp calls 
user-login-name to obtain group name. user-login-name calls getpwuid, 
but getgrgid should be used for that, I think. It might work on 
GNU/Linux systems but it fails on Sun systems, at least the one I have 
access to. On the Sun system UID's and GID's are not disjoint.
With the changes I suggest above there is no need to make a lisp 
interface to getgrgid since the translation may be done in dired.c.

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

* Re: ls-lisp and remote files
  2003-10-30 20:06 ls-lisp and remote files Lars Hansen
@ 2003-10-30 20:25 ` Stefan Monnier
  2003-11-05 21:39   ` Kai Grossjohann
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2003-10-30 20:25 UTC (permalink / raw)
  Cc: tramp-devel, emacs-devel

> I have implemented these change on my own machine (dired.c, lisp.h,
> ls-lisp.el, tramp.el) and it seems to work fine.

> I want to ask people what you think about this suggestion.

I think this was requested already in the past and it would be
good to have.  Maybe someone else remembers better in which context
this came up and what was done about it.


        Stefan

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

* Re: ls-lisp and remote files
  2003-10-30 20:25 ` Stefan Monnier
@ 2003-11-05 21:39   ` Kai Grossjohann
  2003-11-06 13:37     ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Kai Grossjohann @ 2003-11-05 21:39 UTC (permalink / raw)
  Cc: Lars Hansen, tramp-devel, emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> I have implemented these change on my own machine (dired.c, lisp.h,
>> ls-lisp.el, tramp.el) and it seems to work fine.
>
>> I want to ask people what you think about this suggestion.
>
> I think this was requested already in the past and it would be
> good to have.  Maybe someone else remembers better in which context
> this came up and what was done about it.

I had a similar problem with remote VC.  Now Tramp does weird stuff to
circumvent the numerical ids problem, I think.  I think the most
recent workaround is that Michael made it so that Tramp invents user
ids for remote files and maintains its own mapping between user id and
user name.  But that doesn't make sense.

I also remember that I looked in the whole Emacs source tree (Lisp
part only, though) to see if the numerical id is ever actually used.
It turned out that what the code really wants is the user name.

So I believe it would be good to at least offer the code the ability
to request names instead of numbers, and to then convert the existing
code to the names.  Then, VC could work without those kludges.

Warning: I'm out of the loop now and my memory is hazy, quite possibly
this is wrong.  *sigh*  Later, I'll be able to invest more brains into
this, I hope.

Kai

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

* Re: ls-lisp and remote files
  2003-11-05 21:39   ` Kai Grossjohann
@ 2003-11-06 13:37     ` Stefan Monnier
  2003-11-06 14:25       ` Lars Hansen
                         ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Stefan Monnier @ 2003-11-06 13:37 UTC (permalink / raw)
  Cc: Lars Hansen, tramp-devel, emacs-devel

> I also remember that I looked in the whole Emacs source tree (Lisp
> part only, though) to see if the numerical id is ever actually used.
> It turned out that what the code really wants is the user name.

That's what I remember as well.
I think we should simply switch to user-names, but if compatibility
is a problem, we can just provide an additional argument to select
between the two behaviors.


        Stefan

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

* Re: ls-lisp and remote files
  2003-11-06 13:37     ` Stefan Monnier
@ 2003-11-06 14:25       ` Lars Hansen
  2003-11-08  2:16       ` Richard Stallman
  2003-11-09 21:29       ` Lars Hansen
  2 siblings, 0 replies; 18+ messages in thread
From: Lars Hansen @ 2003-11-06 14:25 UTC (permalink / raw)
  Cc: tramp-devel, Kai Grossjohann, emacs-devel

Stefan Monnier wrote:

>I think we should simply switch to user-names, but if compatibility
>is a problem, we can just provide an additional argument to select
>between the two behaviors.
>
Just switching to names rather than numbers for user id and group id 
sounds appealing to me -- then we wouldn't have to introduce an 
additional parameter to file-attributes and directory-files-and-attributes.

What is most important here, simplicity or compatibility?

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

* Re: ls-lisp and remote files
  2003-11-06 13:37     ` Stefan Monnier
  2003-11-06 14:25       ` Lars Hansen
@ 2003-11-08  2:16       ` Richard Stallman
  2003-11-09 21:29       ` Lars Hansen
  2 siblings, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2003-11-08  2:16 UTC (permalink / raw)
  Cc: larsh, tramp-devel, kai, emacs-devel

    > It turned out that what the code really wants is the user name.

    That's what I remember as well.
    I think we should simply switch to user-names, but if compatibility
    is a problem, we can just provide an additional argument to select
    between the two behaviors.

It sounds good to me.

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

* Re: ls-lisp and remote files
  2003-11-06 13:37     ` Stefan Monnier
  2003-11-06 14:25       ` Lars Hansen
  2003-11-08  2:16       ` Richard Stallman
@ 2003-11-09 21:29       ` Lars Hansen
  2003-11-10 21:57         ` Richard Stallman
  2 siblings, 1 reply; 18+ messages in thread
From: Lars Hansen @ 2003-11-09 21:29 UTC (permalink / raw)
  Cc: tramp-devel, Kai Grossjohann, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 851 bytes --]

>
>
>>I also remember that I looked in the whole Emacs source tree (Lisp
>>part only, though) to see if the numerical id is ever actually used.
>>It turned out that what the code really wants is the user name.
>>    
>>
>
>That's what I remember as well.
>I think we should simply switch to user-names, but if compatibility
>is a problem, we can just provide an additional argument to select
>between the two behaviors.
>  
>
I have done some searching in the source tree myself now. There are no 
problems in the C code, but in the lisp code I have found more that 10 
files that expects UID to be numeric. It may be true that all of them 
can be changed to use names rather than ids, but it requires more work 
than I can handle myself. Therefore I suggest we introduce an additional 
argument to file-attributes and directory-files-and-attributes.

[-- Attachment #1.2: Type: text/html, Size: 1157 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Tramp-devel mailing list
Tramp-devel@nongnu.org
http://mail.nongnu.org/mailman/listinfo/tramp-devel

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

* Re: ls-lisp and remote files
  2003-11-09 21:29       ` Lars Hansen
@ 2003-11-10 21:57         ` Richard Stallman
  2003-11-11  7:03           ` Lars Hansen
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2003-11-10 21:57 UTC (permalink / raw)
  Cc: tramp-devel, kai, monnier, emacs-devel

    I have done some searching in the source tree myself now. There are no 
    problems in the C code, but in the lisp code I have found more that 10 
    files that expects UID to be numeric. It may be true that all of them 
    can be changed to use names rather than ids, but it requires more work 
    than I can handle myself. Therefore I suggest we introduce an additional 
    argument to file-attributes and directory-files-and-attributes.

I think would be better, because the result would be cleaner overall,
if we changed all those ten files.  Are there people who want to do that?

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

* Re: ls-lisp and remote files
  2003-11-10 21:57         ` Richard Stallman
@ 2003-11-11  7:03           ` Lars Hansen
  2003-11-12  2:29             ` Richard Stallman
  2003-11-12 22:12             ` Kai Grossjohann
  0 siblings, 2 replies; 18+ messages in thread
From: Lars Hansen @ 2003-11-11  7:03 UTC (permalink / raw)
  Cc: tramp-devel, kai, monnier, emacs-devel

Richard Stallman wrote:

>I think would be better, because the result would be cleaner overall,
>if we changed all those ten files.  Are there people who want to do that?
>  
>
I agree that it would be cleaner.

Let me list the lisp files that I think need to be changed:

      files.el
      ls-lisp.el
      tramp.el
      vc-sccs.el
      fast-lock.el
      server.el
      vc-rcs.el
      find-lisp.el
      info.el
      net/tramp.el
      net/tramp-smb.el
      net/ange-ftp.el
      net/tramp-vc.el
      eshell/esh-util.el
      eshell/em-ls.el
      eshell/em-unix.el
      eshell/em-pred.el
      gnus/nneething.el
      mail/blessmail.el

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

* Re: ls-lisp and remote files
  2003-11-11  7:03           ` Lars Hansen
@ 2003-11-12  2:29             ` Richard Stallman
  2003-11-12 10:41               ` Lars Hansen
  2003-11-12 22:12             ` Kai Grossjohann
  1 sibling, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2003-11-12  2:29 UTC (permalink / raw)
  Cc: tramp-devel, kai, monnier, emacs-devel

    Let me list the lisp files that I think need to be changed:

If the changes are trivial, and especially if the changes make things
cleaner, then I think it is a good idea.  Returning numbers here is
ugly, and it would be good to get rid of that ugliness.

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

* Re: ls-lisp and remote files
  2003-11-12  2:29             ` Richard Stallman
@ 2003-11-12 10:41               ` Lars Hansen
  2003-11-13  2:39                 ` Richard Stallman
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Hansen @ 2003-11-12 10:41 UTC (permalink / raw)
  Cc: tramp-devel, kai, monnier, emacs-devel

>
>
>If the changes are trivial, and especially if the changes make things
>cleaner, then I think it is a good idea.  Returning numbers here is
>ugly, and it would be good to get rid of that ugliness.
>  
>
I agree that always returning strings is the best solution. But it 
requires a lot of thorough code reading to be sure that the changes 
required really are trivial and to make those changes without 
introducing bugs. Much more work than I can handle myself. I understand 
from Kai and Stefan that these changes have been considered before, but 
that nothing was done. I fear that the same might happen again. And I 
think that introducing an optional parameter is better than doing noting 
at all. But if you can convince some people to work on these changes, 
maybe even someone with knowledge of some of the modules, I will gladly 
participate.

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

* Re: ls-lisp and remote files
  2003-11-11  7:03           ` Lars Hansen
  2003-11-12  2:29             ` Richard Stallman
@ 2003-11-12 22:12             ` Kai Grossjohann
  1 sibling, 0 replies; 18+ messages in thread
From: Kai Grossjohann @ 2003-11-12 22:12 UTC (permalink / raw)


Lars Hansen <larsh@math.ku.dk> writes:

> Richard Stallman wrote:
>
>>I think would be better, because the result would be cleaner overall,
>>if we changed all those ten files.  Are there people who want to do that?
>>
>>
> I agree that it would be cleaner.
>
> Let me list the lisp files that I think need to be changed:

It seems I should participate here.

>       tramp.el
>       net/tramp.el
>       net/tramp-smb.el
>       net/tramp-vc.el

These are easy because they really want to have strings, and so all
that's needed is to remove the kludges.

I'm afraid that I can't promise to work on this soon; Real Life is
taking its toll.  But it's now on my todo list.

And then, of course, it's quite possible that Michael Albinus will be
faster than me.  He's always been in the past couple of months.  Kudos
to Michael.

>       net/ange-ftp.el
>       vc-rcs.el

For these, I have a vague idea that maybe I can figure out what's
needed.  Doesn't sound that promising, right?

Kai

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

* Re: ls-lisp and remote files
  2003-11-12 10:41               ` Lars Hansen
@ 2003-11-13  2:39                 ` Richard Stallman
  2003-11-13 17:21                   ` Kevin Rodgers
  2003-11-14 10:36                   ` Lars Hansen
  0 siblings, 2 replies; 18+ messages in thread
From: Richard Stallman @ 2003-11-13  2:39 UTC (permalink / raw)
  Cc: tramp-devel, kai, monnier, emacs-devel

I agree that adding an option is better than nothing.

The option should be designed so that there is a non-nil value meaning
"numbers" and another non-nil value meaning "strings", so that we can
someday change the meaning of nil.

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

* Re: ls-lisp and remote files
  2003-11-13  2:39                 ` Richard Stallman
@ 2003-11-13 17:21                   ` Kevin Rodgers
  2003-11-13 18:05                     ` Andreas Schwab
  2003-11-14 10:36                   ` Lars Hansen
  1 sibling, 1 reply; 18+ messages in thread
From: Kevin Rodgers @ 2003-11-13 17:21 UTC (permalink / raw)


Richard Stallman wrote:

> The option should be designed so that there is a non-nil value meaning
> "numbers" and another non-nil value meaning "strings", so that we can
> someday change the meaning of nil.

How about any number (e.g. 0) or any string (e.g. "")?


-- 
Kevin Rodgers

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

* Re: ls-lisp and remote files
  2003-11-13 17:21                   ` Kevin Rodgers
@ 2003-11-13 18:05                     ` Andreas Schwab
  2003-11-13 18:48                       ` David Kastrup
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2003-11-13 18:05 UTC (permalink / raw)
  Cc: emacs-devel

Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Richard Stallman wrote:
>
>> The option should be designed so that there is a non-nil value meaning
>> "numbers" and another non-nil value meaning "strings", so that we can
>> someday change the meaning of nil.
>
> How about any number (e.g. 0) or any string (e.g. "")?

Or maybe 'numberp and 'stringp.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: ls-lisp and remote files
  2003-11-13 18:05                     ` Andreas Schwab
@ 2003-11-13 18:48                       ` David Kastrup
  2003-11-14 20:09                         ` Richard Stallman
  0 siblings, 1 reply; 18+ messages in thread
From: David Kastrup @ 2003-11-13 18:48 UTC (permalink / raw)
  Cc: Kevin Rodgers, emacs-devel

Andreas Schwab <schwab@suse.de> writes:

> Kevin Rodgers <ihs_4664@yahoo.com> writes:
> 
> > Richard Stallman wrote:
> >
> >> The option should be designed so that there is a non-nil value meaning
> >> "numbers" and another non-nil value meaning "strings", so that we can
> >> someday change the meaning of nil.
> >
> > How about any number (e.g. 0) or any string (e.g. "")?
> 
> Or maybe 'numberp and 'stringp.

The original proposal has the advantage that

(setq x (what-were-we-talking-about x))

will retain the type.  Almost as easy would be to use the values

(type-of 0) and (type-of "")

(after evaluation, of course).  There is no similarly straightforward
mapping from a number to 'numberp and a string to 'stringp AFAIR.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: ls-lisp and remote files
  2003-11-13  2:39                 ` Richard Stallman
  2003-11-13 17:21                   ` Kevin Rodgers
@ 2003-11-14 10:36                   ` Lars Hansen
  1 sibling, 0 replies; 18+ messages in thread
From: Lars Hansen @ 2003-11-14 10:36 UTC (permalink / raw)
  Cc: tramp-devel, kai, monnier, emacs-devel

Richard Stallman wrote:

>The option should be designed so that there is a non-nil value meaning
>"numbers" and another non-nil value meaning "strings", so that we can
>someday change the meaning of nil.
>  
>
I like that idea. How about this:

We introduce a parameter ID-FORMAT with the following meaning:
If ID-FORMAT is numeric or nil, UID and GID are returned as integers, 
otherwise as strings.

Over time we can change all calls so they include ID-FORMAT with a value 
of 0 or t, and we can try to avoid using 0. Once the lisp source has no 
calls with ID-FORMAT left out, we can change the meaning of nil such 
that UID and GID are returned as strings in that case. Then we can 
remove the parameter from the calls where it has value t, and if the 
parameter then is unused, we may even remove it from the definition.

These plans should be written in the lisp manual and the TODO file, I think.

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

* Re: ls-lisp and remote files
  2003-11-13 18:48                       ` David Kastrup
@ 2003-11-14 20:09                         ` Richard Stallman
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2003-11-14 20:09 UTC (permalink / raw)
  Cc: schwab, ihs_4664, emacs-devel

      Almost as easy would be to use the values

    (type-of 0) and (type-of "")

Those values are `integer' and `string'.  I like that approach.

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

end of thread, other threads:[~2003-11-14 20:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-30 20:06 ls-lisp and remote files Lars Hansen
2003-10-30 20:25 ` Stefan Monnier
2003-11-05 21:39   ` Kai Grossjohann
2003-11-06 13:37     ` Stefan Monnier
2003-11-06 14:25       ` Lars Hansen
2003-11-08  2:16       ` Richard Stallman
2003-11-09 21:29       ` Lars Hansen
2003-11-10 21:57         ` Richard Stallman
2003-11-11  7:03           ` Lars Hansen
2003-11-12  2:29             ` Richard Stallman
2003-11-12 10:41               ` Lars Hansen
2003-11-13  2:39                 ` Richard Stallman
2003-11-13 17:21                   ` Kevin Rodgers
2003-11-13 18:05                     ` Andreas Schwab
2003-11-13 18:48                       ` David Kastrup
2003-11-14 20:09                         ` Richard Stallman
2003-11-14 10:36                   ` Lars Hansen
2003-11-12 22:12             ` Kai Grossjohann

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