From: "SZEDER Gábor" <szeder@ira•uka.de>
To: Jeff King <peff@peff•net>
Cc: Sverre Rabbelier <srabbelier@gmail•com>,
Jonathan Nieder <jrnieder@gmail•com>,
Git List <git@vger•kernel.org>,
"Shawn O. Pearce" <gsoc@spearce•org>,
Stephen Boyd <bebarino@gmail•com>
Subject: Re: [BUG] Autocompletion fails with "bash: words: bad array subscript"
Date: Wed, 11 May 2011 00:39:35 +0200 [thread overview]
Message-ID: <20110510223935.GA31029@goldbirke> (raw)
In-Reply-To: <20110510211016.GB26231@sigill.intra.peff.net>
Hi,
On Tue, May 10, 2011 at 05:10:16PM -0400, Jeff King wrote:
> On Tue, May 10, 2011 at 11:02:53PM +0200, Sverre Rabbelier wrote:
>
> > On Tue, May 10, 2011 at 23:01, Jeff King <peff@peff•net> wrote:
> > > Right. Bash calls into our __git() completion function, which calls the
> > > implementation of _get_comp_words_by_ref from /etc/bash_completion,
> > > which has the bug. If you don't source git completion, then you are just
> > > getting bash's default file completion.
> >
> > So should we file this bug with bash's completion people?
>
> Probably, but it would be nice to reduce it to a smaller test case (or
> one that happens just with completions shipped by Debian) just to rule
> out anything git is doing.
Thinking a bit more about it, you don't even need to search history to
reproduce. Try this:
_foo ()
{
local prev
_get_comp_words_by_ref prev
}
complete -F _foo foo
Then type "foo", go back to the very beginning of the command line,
and then press TAB, and the same "bash: words: bad array subscript"
error appears.
So the bug is definitely not git-related. The fix would be a check
along the lines of the first two hunks of the patch I just sent out.
Oddly enough, the bash-completion folks had a similar check in the now
deprecated _get_pword() function, that didn't made it into
_get_comp_words_by_ref()...
Best,
Gábor
next prev parent reply other threads:[~2011-05-10 22:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-10 20:13 [BUG] Autocompletion fails with "bash: words: bad array subscript" Sverre Rabbelier
2011-05-10 20:31 ` Jeff King
2011-05-10 20:39 ` Jeff King
2011-05-10 20:47 ` Sverre Rabbelier
2011-05-10 21:01 ` Jeff King
2011-05-10 21:02 ` Sverre Rabbelier
2011-05-10 21:10 ` Jeff King
2011-05-10 22:39 ` SZEDER Gábor [this message]
2011-05-10 23:45 ` Jonathan Nieder
2011-05-11 21:09 ` SZEDER Gábor
2011-05-10 22:14 ` [PATCH] completion: fix array indexing error after reverse history search SZEDER Gábor
2011-05-10 22:19 ` Sverre Rabbelier
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=20110510223935.GA31029@goldbirke \
--to=szeder@ira$(echo .)uka.de \
--cc=bebarino@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gsoc@spearce$(echo .)org \
--cc=jrnieder@gmail$(echo .)com \
--cc=peff@peff$(echo .)net \
--cc=srabbelier@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox