GNU bug report logs - #54885
29.0.50; Tramp completion support for top-level sshconfig include

Previous Next

Package: emacs;

Reported by: Bartosz Kaczyński <bk <at> asterio.cloud>

Date: Tue, 12 Apr 2022 14:24:02 UTC

Severity: wishlist

Tags: moreinfo

Found in version 29.0.50

Fixed in version 29.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54885 in the body.
You can then email your comments to 54885 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#54885; Package emacs. (Tue, 12 Apr 2022 14:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bartosz Kaczyński <bk <at> asterio.cloud>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Apr 2022 14:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bartosz Kaczyński <bk <at> asterio.cloud>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Tramp completion support for top-level sshconfig include
Date: Tue, 12 Apr 2022 15:53:08 +0200
emacs -Q

Hi, I noticed that TRAMP hostname complation doesn't support my 
top-level sshconfig like below:

tree ~/.ssh/conf.d/
/home/bk/.ssh/conf.d/
├── domainX
├── domainY
└── personal

My ~/.ssh/config contains only one line

Include conf.d/*

and it's work perfectly from the shell by Emacs can't parse this Include 
directive. It would be very useful enhancement if the built-in 
completion frameworks (I use icomplete with vertical mode) can handle 
that structure which I first saw on counsel-tramp package(1).

1. 
https://github.com/masasam/emacs-counsel-tramp#support-for-top-level-sshconfig-include


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.33, cairo version 1.16.0)
 of 2022-04-12 built on RSQ-P030.rsq.local
Repository revision: 78784ccfadaee1c86207ecc360db7236285713f5
Repository branch: master
System Description: openSUSE MicroOS

Configured using:
 'configure --with-native-compilation --with-json --with-pgtk'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM GTK3 ZLIB

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8

Major mode: Helpful

Minor modes in effect:
  windmove-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  shell-dirtrack-mode: t
  which-key-mode: t
  save-place-mode: t
  savehist-mode: t
  recentf-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media rmc puny rfc822 mml
mml-sec epa epg rfc6068 epg-config gnus-util text-property-search
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils mule-util jka-compr dired-aux dired dired-loaddefs tramp-sh
tramp-cache tramp tramp-loaddefs trampver tramp-integration cus-start
tramp-compat parse-time ls-lisp helpful imenu trace edebug backtrace
info-look f help-fns radix-tree elisp-refs s rainbow-delimiters vc-git
diff-mode vc-dispatcher server init init-locales init-tools
init-navigation windmove init-misc init-devel smartparens thingatpt dash
init-snippets yasnippet-snippets yasnippet init-gnus init-org ob-python
python ob-plantuml ob-restclient restclient ob-sql ob-shell shell org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601
time-date ol org-keys oc org-compat advice org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs init-restclient
init-command-lines init-c-cpp init-config-files init-erc init-pass
init-tramp cus-edit pp cus-load files-x init-dired init-minibuffer
which-key saveplace savehist recentf tree-widget wid-edit icomplete
init-defaults modus-vivendi-theme modus-themes pcase
display-line-numbers init-exec-path exec-path-from-shell init-elpa
fullframe finder-inf info package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source eieio eieio-core
eieio-loaddefs password-cache json map url-vars init-site-lisp
init-utils init-benchmarking derived comp comp-cstr warnings rx cl-seq
cl-macs cl-extra help-mode seq gv subr-x byte-opt cl-loaddefs cl-lib
bytecomp byte-compile cconv early-init iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice simple cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 552105 260802)
 (symbols 48 30739 3)
 (strings 32 145715 35356)
 (string-bytes 1 4211779)
 (vectors 16 50703)
 (vector-slots 8 888993 274160)
 (floats 8 371 1031)
 (intervals 56 1767 509)
 (buffers 992 17))





Severity set to 'wishlist' from 'normal' Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Wed, 13 Apr 2022 06:30:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54885; Package emacs. (Wed, 13 Apr 2022 07:15:02 GMT) Full text and rfc822 format available.

Message #10 received at 54885 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Bartosz Kaczyński <bk <at> asterio.cloud>
Cc: 54885 <at> debbugs.gnu.org
Subject: Re: bug#54885: 29.0.50; Tramp completion support for top-level
 sshconfig include
Date: Wed, 13 Apr 2022 09:13:59 +0200
Bartosz Kaczyński <bk <at> asterio.cloud> writes:

Hi Bartosz,

> Hi, I noticed that TRAMP hostname complation doesn't support my
> top-level sshconfig like below:
>
> tree ~/.ssh/conf.d/
> /home/bk/.ssh/conf.d/
> ├── domainX
> ├── domainY
> └── personal
>
> My ~/.ssh/config contains only one line
>
> Include conf.d/*
>
> and it's work perfectly from the shell by Emacs can't parse this
> Include directive. It would be very useful enhancement if the built-in
> completion frameworks (I use icomplete with vertical mode) can handle
> that structure which I first saw on counsel-tramp package(1).
>
> 1. https://github.com/masasam/emacs-counsel-tramp#support-for-top-level-sshconfig-include

Tramp doesn't handle sshconfig includes. However, you can emulate it
yourself with the following snippet in your .emacs (untested):

--8<---------------cut here---------------start------------->8---
(defvar my-tramp-completion-function-alist-ssh nil)

(dolist (file (directory-files "~/.ssh/conf.d/" 'full directory-files-no-dot-files-regexp))
  (add-to-list 'my-tramp-completion-function-alist-ssh
	       `(tramp-parse-sconfig ,file)))

(tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
(tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54885; Package emacs. (Wed, 13 Apr 2022 14:45:02 GMT) Full text and rfc822 format available.

Message #13 received at 54885 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Bartosz Kaczyński <bk <at> asterio.cloud>
Cc: 54885 <at> debbugs.gnu.org
Subject: Re: bug#54885: 29.0.50; Tramp completion support for top-level
 sshconfig include
Date: Wed, 13 Apr 2022 16:44:20 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi Bartosz,

> Tramp doesn't handle sshconfig includes. However, you can emulate it
> yourself with the following snippet in your .emacs (untested):

Hmm, there was an error in the snipptet. I've reworked it, and added to
the Tramp manual (pushed to master):

--8<---------------cut here---------------start------------->8---
4.18.1 Using ssh config include for host name completion
--------------------------------------------------------

OpenSSH configuration files can use an ‘Include’ option for further
configuration files.  Default TRAMP host name completion ignores this
option.  However, you can configure this yourself.

   Given, your ‘~/.ssh/config’ file contains the following option:

     Include ~/.ssh/conf.d/*

   The following code snippet in your ‘.emacs’ uses all files in that
directory for host name completion:

     (tramp-set-completion-function
      "ssh" (append (tramp-get-completion-function "ssh")
                    (mapcar (lambda (file) `(tramp-parse-sconfig ,file))
                            (directory-files
                             "~/.ssh/conf.d/"
                             'full directory-files-no-dot-files-regexp))))

   This code snippet does it for the ‘ssh’ method.  If you replace
"ssh" by "scp", it does it also for that method (or any other method
you like).
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 13 Apr 2022 14:51:01 GMT) Full text and rfc822 format available.

Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Wed, 13 Apr 2022 15:30:02 GMT) Full text and rfc822 format available.

Notification sent to Bartosz Kaczyński <bk <at> asterio.cloud>:
bug acknowledged by developer. (Wed, 13 Apr 2022 15:30:02 GMT) Full text and rfc822 format available.

Message #20 received at 54885-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Bartosz Kaczyński <bk <at> asterio.cloud>
Cc: 54885-done <at> debbugs.gnu.org
Subject: Re: bug#54885: 29.0.50; Tramp completion support for top-level
 sshconfig include
Date: Wed, 13 Apr 2022 17:29:42 +0200
Version: 29.1

Bartosz Kaczyński <bk <at> asterio.cloud> writes:

> Hi Michael,

Hi Bartosz,

> thank you. These few lines made my work lot easier and it's huge
> improvement.

Thanks for the feedback, I'm closing the bug.

> Best regards, Bartosz.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54885; Package emacs. (Wed, 13 Apr 2022 15:31:03 GMT) Full text and rfc822 format available.

Message #23 received at 54885 <at> debbugs.gnu.org (full text, mbox):

From: Bartosz Kaczyński <bk <at> asterio.cloud>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 54885 <at> debbugs.gnu.org
Subject: Re: bug#54885: 29.0.50; Tramp completion support for top-level
 sshconfig include
Date: Wed, 13 Apr 2022 17:22:09 +0200
Hi Michael,

thank you. These few lines made my work lot easier and it's huge 
improvement.

Best regards, Bartosz.

On 4/13/22 16:44, Michael Albinus wrote:
> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
> Hi Bartosz,
>
>> Tramp doesn't handle sshconfig includes. However, you can emulate it
>> yourself with the following snippet in your .emacs (untested):
> Hmm, there was an error in the snipptet. I've reworked it, and added to
> the Tramp manual (pushed to master):
>
> --8<---------------cut here---------------start------------->8---
> 4.18.1 Using ssh config include for host name completion
> --------------------------------------------------------
>
> OpenSSH configuration files can use an ‘Include’ option for further
> configuration files.  Default TRAMP host name completion ignores this
> option.  However, you can configure this yourself.
>
>     Given, your ‘~/.ssh/config’ file contains the following option:
>
>       Include ~/.ssh/conf.d/*
>
>     The following code snippet in your ‘.emacs’ uses all files in that
> directory for host name completion:
>
>       (tramp-set-completion-function
>        "ssh" (append (tramp-get-completion-function "ssh")
>                      (mapcar (lambda (file) `(tramp-parse-sconfig ,file))
>                              (directory-files
>                               "~/.ssh/conf.d/"
>                               'full directory-files-no-dot-files-regexp))))
>
>     This code snippet does it for the ‘ssh’ method.  If you replace
> "ssh" by "scp", it does it also for that method (or any other method
> you like).
> --8<---------------cut here---------------end--------------->8---
>
> Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 May 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.