From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: SSH hostname completion with common suffix and globcomplete inserts characters
Date: Wed, 17 Aug 2016 15:36:18 -0700 [thread overview]
Message-ID: <160817153618.ZM22548@torch.brasslantern.com> (raw)
In-Reply-To: <705fb246-abcf-176b-d4fa-eb0e01cded05@thequod.de>
On Aug 17, 9:16pm, Daniel Hahler wrote:
}
} % echo "Host test-05827d88.foo.bar test-6cae9ce0.foo.bar" > ssh_config
} % setopt globcomplete
} % ssh -F ssh_config test-<TAB>
} % ssh -F ssh_config test-|.foo.bar
} % ssh -F ssh_config test-|BR.foo.bar
I compared _complete_debug output for the two cases and there's no
significant difference until the value of compstate[unambiguous] is
displayed near the end, so this looks like an off-by-one error in
the internals.
Cursory examination seems to point to implicit addition/removal of
the "*" pattern at the cursor position when doing globcomplete. If
instead one explicitly completes
% ssh -F ssh_config test-*<TAB>
then a listing of possible matches appears and the update of the line
is correct.
} The characters being inserted seem to come from the "bar".
I think the characters being inserted are just stack (or heap) garbage;
it may coincidentally be garbage derived from trying a case replacement,
but I don't think that's directly related.
Places to look more closely seem to be computil.c:cfp_opt_pats() and
compcore.c:addmatches(), look for comppatmatch. For example, most of
cfp_opt_pats() is skipped if the prefix or suffix already contains a
pattern (as in "test-*") but is active if the prefix has no pattern
and comppatmatch is non-empty (as is the case for globcomplete).
prev parent reply other threads:[~2016-08-17 22:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 19:16 Daniel Hahler
2016-08-17 19:38 ` Daniel Hahler
2016-08-17 22:52 ` Daniel Hahler
2016-08-18 5:32 ` Bart Schaefer
2016-08-17 22:36 ` Bart Schaefer [this message]
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=160817153618.ZM22548@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@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).