all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place
@ 2008-03-19 21:14 Phil Hagelberg
  2008-03-20 17:51 ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Hagelberg @ 2008-03-19 21:14 UTC (permalink / raw)
  To: emacs-pretest-bug

The function pcmpl-ssh-hosts (which is invoked when you launch eshell
and type "ssh host<tab>") fails when the last entry in your
pcmpl-ssh-known-hosts-file has a space after the hostname instead of a
comma. I believe newer versions of openssh do this.

I have a patch to fix this at http://hagelb.org/pcmpl-ssh-space.patch.

In GNU Emacs 23.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.12.0)
 of 2007-12-17 on dynabook
Windowing system distributor `The X.Org Foundation', version 11.0.10300000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: EShell

Minor modes in effect:
  shell-dirtrack-mode: t
  show-paren-mode: t
  global-hl-line-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
k e d SPC w h e n SPC y o u SPC l a u n c h SPC e s 
h e l l , SPC t y p e SPC S <backspace> s s h SPC M-b 
" C-e h o s t < t a b > " M-b M-b M-b M-b C-b <backspace> 
SPC a n d SPC <backspace> C-e ) SPC <backspace> M-q 
SPC f a i l s SPC w h e n SPC t h e SPC l a s t SPC 
e n t r y SPC i n SPC y o u r SPC C-h v s <backspace> 
p c m p l - s s h <tab> C-M-h <tab> <tab> C-M-h s s 
h <tab> <tab> C-y M-q SPC C-x C-f . s s h / k n <return> 
M-> C-x C-f c o n <return> M-> C-x k <return> C-p C-p 
C-n C-x k <return> h a s SPC a SPC s p a c e SPC a 
f t e r SPC t h e SPC h o s t n a m e SPC i n s t e 
a d SPC o f SPC a SPC c o m m a . M-q C-n C-n C-a C-n 
C-n C-p C-p C-p C-p C-n C-n C-p C-k C-k C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-g M-< C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-p C-p C-p C-p C-p C-p C-SPC C-n C-n C-n C-n M-w 
C-x k <return> C-x o C-x k <return> C-x C-g M-x r e 
p o r t - e m a <tab> <return>

Recent messages:
Reading active file via nnml...
nnml: Reading incoming mail from file...
nnml: Reading incoming mail (no new mail)...done
Reading active file via nnml...done
Reading active file from archive via nnfolder...done
Checking new news...done
Quit
Mark set [3 times]
Quit
Mark set [2 times]




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

* Re: 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place
  2008-03-19 21:14 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place Phil Hagelberg
@ 2008-03-20 17:51 ` Glenn Morris
       [not found]   ` <87iqzgx77t.fsf@hagelb.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2008-03-20 17:51 UTC (permalink / raw)
  To: Phil Hagelberg; +Cc: emacs-pretest-bug

Phil Hagelberg wrote:

> The function pcmpl-ssh-hosts (which is invoked when you launch
> eshell and type "ssh host<tab>") fails when the last entry in your
> pcmpl-ssh-known-hosts-file has a space after the hostname instead of
> a comma.

I don't understand what you mean. Do you mean they changed the format
from this:

host1,host1a,host1b,... bits exponent modulus comment

to this

host1 host1a host1b ... bits exponent modulus comment

?

> I have a patch to fix this at http://hagelb.org/pcmpl-ssh-space.patch.

Err, great. Why not just paste the tiny, tiny patch into your mail?

diff -r1.12 pcmpl-unix.el
147c147
<           (while (and (looking-back ",")
---
>           (while (and (looking-back "[ ,]")

Isn't this going to pick up all the other, non-hostname, fields as well?

If the format has indeed changed in the above way, I guess it will be
necessary to count columns, or try more restrictive patterns for the
hostnames. The joy of progress...




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

* Re: 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place
       [not found]   ` <87iqzgx77t.fsf@hagelb.org>
@ 2008-03-24 20:28     ` Glenn Morris
  2008-04-09 16:28       ` Phil Hagelberg
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2008-03-24 20:28 UTC (permalink / raw)
  To: Phil Hagelberg; +Cc: Emacs developers



Please let's keep this on the list.


Phil Hagelberg wrote (on Fri, 21 Mar 2008 at 11:28 -0700):

> Glenn Morris <rgm@gnu.org> writes:
> 
> >> The function pcmpl-ssh-hosts (which is invoked when you launch
> >> eshell and type "ssh host<tab>") fails when the last entry in your
> >> pcmpl-ssh-known-hosts-file has a space after the hostname instead of
> >> a comma.
> >
> > I don't understand what you mean. Do you mean they changed the format
> > from this:
> >
> > host1,host1a,host1b,... bits exponent modulus comment
> >
> > to this
> >
> > host1 host1a host1b ... bits exponent modulus comment
> 
> No, my understanding is that every line of the known_hosts file consists
> of either:
> 
> * A hostname, a separator, an IP address, a separator, then a
>   description of the key
> * An IP address, a separator, then a description of the key
> * A hostname, a separator, then a description of the key

I quote from `man sshd' on my RHEL5 system:

SSH_KNOWN_HOSTS FILE FORMAT

...

   Each line in these files contains the following fields: hostnames,
   bits, exponent, modulus, comment.  The fields are separated by spaces.

   Hostnames is a comma-separated list of patterns...

This is "OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006".

> The problem the patch addresses is that the separator can be a comma
> *or* a space. But it's not that complicated because what we really want
> is just whatever appears before the first separator.
> 
> I don't think we need to include the IP address for the first case above
> since I believe once you do refer to a host by its IP address, it will
> create another entry in the file that refers only to the IP address.

My own known_hosts file contains many entries like this:

host1.full.domain,host1,host1-alias,host-generic,ip1 ssh-rsa ...
host2.full.domain,host2,host2-alias,host-generic,ip2 ssh-rsa ...

There's nothing to say that the first entry is the only one I'll ever
want to complete on (indeed it's usually one of the other forms).




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

* Re: 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place
  2008-03-24 20:28     ` Glenn Morris
@ 2008-04-09 16:28       ` Phil Hagelberg
  2008-04-09 19:29         ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Hagelberg @ 2008-04-09 16:28 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Emacs developers


Sorry, I lost this email for a while when I was switching machines.

Glenn Morris <rgm@gnu.org> writes:

> I quote from `man sshd' on my RHEL5 system:
>
> SSH_KNOWN_HOSTS FILE FORMAT
>
> ...
>
>    Each line in these files contains the following fields: hostnames,
>    bits, exponent, modulus, comment.  The fields are separated by spaces.
>
>    Hostnames is a comma-separated list of patterns...
>
> This is "OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006".

> My own known_hosts file contains many entries like this:
>
> host1.full.domain,host1,host1-alias,host-generic,ip1 ssh-rsa ...
> host2.full.domain,host2,host2-alias,host-generic,ip2 ssh-rsa ...

Interesting. I have never seen a file like this in practice, but I have
not used Red Hat in a long time. Thanks for bringing this to my
attention.

Recently it's come to my attention that there's already a function that
does this in tramp: tramp-parse-hosts will return a list of user/host
pairs, though on my machine it also returns some key signatures. (I
imagine it could use some debugging as well.)

Clearly this shows some redundancy that should be removed. But I'm not
sure what the best way to go about this is. I don't think pcomplete
should require tramp, nor vice-versa. Perhaps it should be spun out into
a third file that the other two require? I don't feel I have a great
grasp on how files are organized within Emacs.

Thoughts?

-Phil
http://technomancy.us




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

* Re: 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place
  2008-04-09 16:28       ` Phil Hagelberg
@ 2008-04-09 19:29         ` Michael Albinus
  2008-04-10 19:52           ` Phil Hagelberg
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2008-04-09 19:29 UTC (permalink / raw)
  To: Phil Hagelberg; +Cc: Glenn Morris, Emacs developers

Phil Hagelberg <phil@hagelb.org> writes:

> Recently it's come to my attention that there's already a function that
> does this in tramp: tramp-parse-hosts will return a list of user/host
> pairs, though on my machine it also returns some key signatures. (I
> imagine it could use some debugging as well.)

Do you mean tramp-parse-shosts? However, this function cannot work
when hostnames in known_hosts are stored in a hashed form like this:

|1|qgSiQ74dNQtRpDaIQHcQgREbNgs=|jwi3ho8zMuJlFvEEiyufB/wVHeU= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqIGXkE+SgOSOmLqSQHSpsZEVm9Nm2lDzZ0h2RVvtiTzluHYIyuIkMPANvoeFhtmTpXbIllkcXoTUYCCFBc0fpO4O+nTsZmqY0kr52HCmMfMmTvhi+4dlKeLp8UBSaso9XODohFqYyzbMna1sG9S5osSKFHzrKfh4IdLr1fspw97JhSyY1/hzWL2xRR+ljtlwRs3Z1evyasH1UhI/8zyTGv5dUUgCZiNcZyMS5va2FsUChkE2Xjoh1zmDzSmtN62Me7kZCg3+FftH8PT3WMvaGBfLRPfKjwJ3y2KkbodU2z4XMBkFMXNRL9/d5DPkrDc+4vFmKRieKVWBBwr87k7o1Q==

> Clearly this shows some redundancy that should be removed. But I'm not
> sure what the best way to go about this is. I don't think pcomplete
> should require tramp, nor vice-versa. Perhaps it should be spun out into
> a third file that the other two require? I don't feel I have a great
> grasp on how files are organized within Emacs.
>
> Thoughts?

In principle, I agree. But Tramp has also a life outside GNU Emacs 23 ...

> -Phil

Best regards, Michael.




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

* Re: 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place
  2008-04-09 19:29         ` Michael Albinus
@ 2008-04-10 19:52           ` Phil Hagelberg
  0 siblings, 0 replies; 6+ messages in thread
From: Phil Hagelberg @ 2008-04-10 19:52 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Glenn Morris, Emacs developers

Michael Albinus <michael.albinus@gmx.de> writes:

>> Recently it's come to my attention that there's already a function that
>> does this in tramp: tramp-parse-hosts will return a list of user/host
>> pairs, though on my machine it also returns some key signatures. (I
>> imagine it could use some debugging as well.)
>
> Do you mean tramp-parse-shosts? However, this function cannot work
> when hostnames in known_hosts are stored in a hashed form like this:
>
> |1|qgSiQ74dNQtRpDaIQHcQgREbNgs=|jwi3ho8zMuJlFvEEiyufB/wVHeU= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqIGXkE+SgOSOmLqSQHSpsZEVm9Nm2lDzZ0h2RVvtiTzluHYIyuIkMPANvoeFhtmTpXbIllkcXoTUYCCFBc0fpO4O+nTsZmqY0kr52HCmMfMmTvhi+4dlKeLp8UBSaso9XODohFqYyzbMna1sG9S5osSKFHzrKfh4IdLr1fspw97JhSyY1/hzWL2xRR+ljtlwRs3Z1evyasH1UhI/8zyTGv5dUUgCZiNcZyMS5va2FsUChkE2Xjoh1zmDzSmtN62Me7kZCg3+FftH8PT3WMvaGBfLRPfKjwJ3y2KkbodU2z4XMBkFMXNRL9/d5DPkrDc+4vFmKRieKVWBBwr87k7o1Q==

Yes, this is a known limitation of both libraries. It's mentioned in a
docstring in pcmpl-unix.el that you must add "HashKnownHosts no" to your
SSH config to make it work.

>> Clearly this shows some redundancy that should be removed. But I'm not
>> sure what the best way to go about this is. I don't think pcomplete
>> should require tramp, nor vice-versa. Perhaps it should be spun out into
>> a third file that the other two require? I don't feel I have a great
>> grasp on how files are organized within Emacs.
>
> In principle, I agree. But Tramp has also a life outside GNU Emacs 23 ...

Ah; in that case perhaps they should both be left alone.

-Phil




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

end of thread, other threads:[~2008-04-10 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-19 21:14 23.0.50; pcmpl-ssh-hosts breaks when known_hosts file has a space in the wrong place Phil Hagelberg
2008-03-20 17:51 ` Glenn Morris
     [not found]   ` <87iqzgx77t.fsf@hagelb.org>
2008-03-24 20:28     ` Glenn Morris
2008-04-09 16:28       ` Phil Hagelberg
2008-04-09 19:29         ` Michael Albinus
2008-04-10 19:52           ` Phil Hagelberg

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.