Bug#922657: Misfires when variable is put in a string

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#922657: Misfires when variable is put in a string

積丹尼 Dan Jacobson
Package: bash-completion
Version: 1:2.8-5

$ set apt-show-versions
$ zless /usr/share/doc/$@/ch<TAB>
$ zless /usr/share/doc/$@/ch
chromium          chromium-common   chromium-sandbox  chromium-shell
$ zless /usr/share/doc/\$@/chromium

Huh?

OK, now shortening the last string sitting on my terminal, and hitting
TAB again
$ zless /usr/share/doc/\$@/ch<TAB>
it just beeps, proving that adding the \ was nonsense in the first
place.

Anyway
$ echo zless /usr/share/doc/$@/ch*
zless /usr/share/doc/apt-show-versions/changelog.gz

shows what I was trying to match.

I'm not saying you need to deal with $@ (for now yet, maybe in a few
years), but at least don't insert \ .

Reply | Threaded
Open this post in threaded view
|

Bug#922657: Misfires when variable is put in a string

Gabriel F. T. Gomes-2
Control: tags -1 + confirmed upstream

On Tue, Feb 19 2019, 積丹尼 Dan Jacobson wrote:
>
> $ set apt-show-versions
> $ zless /usr/share/doc/$@/ch<TAB>
> $ zless /usr/share/doc/$@/ch
> chromium          chromium-common   chromium-sandbox  chromium-shell
> $ zless /usr/share/doc/\$@/chromium

The backslash is added in _quote_readline_by_ref, by this statement:

  printf -v $2 %q "$1"

It only adds the backslash to unset variables, but not when the variable
is set, for instance:

  zless /usr/share/$PATH/<TAB>

does nothing, whereas

  zless /usr/share/$ASDF/<TAB>
  zless /usr/share/\$ASDF/

causes the problem you describe...  Marking as confirmed and upstream.

Reply | Threaded
Open this post in threaded view
|

Bug#922657: Misfires when variable is put in a string

Gabriel F. T. Gomes-2
On Sun, Mar 10 2019, Gabriel F. T. Gomes wrote:

>
> It only adds the backslash to unset variables, but not when the variable
> is set, for instance:
>
>   zless /usr/share/$PATH/<TAB>
>
> does nothing, whereas
>
>   zless /usr/share/$ASDF/<TAB>
>   zless /usr/share/\$ASDF/
>
> causes the problem you describe...  Marking as confirmed and upstream.

Now reported upstream as https://github.com/scop/bash-completion/issues/290