zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-users@zsh.org>
Subject: Re: Completion issue when zsh is not the default shell
Date: Fri, 26 Oct 2018 15:55:21 +0100	[thread overview]
Message-ID: <20181026145522eucas1p245580c8ddf13dca70b5eae45af9a0205~hMFzZ7wLw1740617406eucas1p2G@eucas1p2.samsung.com> (raw)
In-Reply-To: <CA+mcLN5PjYfJ_yv1xDZW1+0XC7Lok85UGzChq0iUdKXrHD2ULA@mail.gmail.com>

On Fri, 2018-10-26 at 16:25 +0200, Julien Nicoulaud wrote:
> On my work machine bash is the default shell (AD accounts...), and I have
> an issue with the SSH completion:
> 
> ssh sto<TAB>bash: _ssh_hosts: command not found...
> 
> Trace file (see line 622): https://pastebin.com/raw/eE6XJbg2
> 
> It looks like at some point bash is invoked, which tries to resolve
> _ssh_hosts and fails.
> 
> If I explicitly "autoload _ssh_hosts", it works correctly. It looks like a
> bug to me ?

It clearly shouldn't be running bash, but it's entirely unclear from
what you say why it actually is.  So I'm just having to guess.

Presumably _ssh_hosts is being found by your $path, rather than your
$fpath, so being executed as a command rather than function  It's not
clear why your system would be set up to find _ssh_hosts that way --- it
means your shell function directory is being searched for commands --- but
it's not actually a problem in general so long as the "autoload" has
been done.

Given that explicitly using "autoload" works, that means _ssh_hosts *is*
also being found along $fpath.

So the issue is it's not being marked for autoload automatically.  I can
think of a few reasons for this:

1. When "compinit" is run, $fpath isn't yet set up properly.  You'd
need to track this down in the initialisation sequence.  "compinit"
clearly is being run, or the shell wouldn't know about any association
between ssh completion _ssh_hosts.

2. You're hitting an old .zcompdump file that doesn't autoload this
but for some reason doesn't get detected as out of date.  This isn't
particularly likely but "rm ~/.zcompdump*" is an easy thing to try and
only incurs a one-off reload penalty.

3. There's an alternative _ssh_hosts early in your $fpath and it
doesn't contain the first line needed by the completion system,

#autoload

that you'll see in the file that comes with zsh.  This is probably my
top guess.  Have a look at

print -l $^fpath/_ssh_hosts(N)

(expand fpath to include any occurence of _ssh_hosts but remove any
entries that aren't matched as files).

pws



  reply	other threads:[~2018-10-26 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181026142713epcas1p2bcbd7c6efff6d9e809fdbedb51eb6eba@epcas1p2.samsung.com>
2018-10-26 14:25 ` Julien Nicoulaud
2018-10-26 14:55   ` Peter Stephenson [this message]
2018-10-26 18:49     ` Julien Nicoulaud
2018-10-28  4:20       ` Phil Pennock
2018-10-30 15:19         ` Julien Nicoulaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20181026145522eucas1p245580c8ddf13dca70b5eae45af9a0205~hMFzZ7wLw1740617406eucas1p2G@eucas1p2.samsung.com' \
    --to=p.stephenson@samsung.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).