[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TAB completion bug
From: |
Kerin Millar |
Subject: |
Re: TAB completion bug |
Date: |
Wed, 6 Dec 2023 05:43:43 +0000 |
On Tue, 5 Dec 2023 23:46:51 +0000
Ole Tange via Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org>
wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2
> uname output: Linux aspire 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2
> 15:18:56 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 5.2
> Patch Level: 21
> Release Status: release
>
> Description:
> Tested on git (2023-12-06).
>
> For the (admitedly weirdly named) dirs below TAB completion does not work
> correctly.
>
> Repeat-By:
> #!/bin/bash
>
> # TAB works
> # $ ls -l ta<TAB><TAB><TAB><TAB><TAB><TAB>
> # <works>
> # Tab completes but is escaped wrongly:
> # $ ls -l ta<TAB><TAB><TAB><TAB><TAB><TAB><TAB>
> # <completes wrongly>
I can confirm this for both 5.2.21 and the development branch. The backticks
are not quoted as they ought to be, resulting in a command substitution.
>
> mkdir -p 'tab/
> `/tmp/trip`>/tmp/tripwire;
> '"'"'@<?[]|~\/tmp'
>
> # These give the same
> # $ ls -l tw<TAB><TAB><TAB><TAB>
> # $ ls -l tw<TAB><TAB><TAB><TAB><TAB>
> # But the last should include tmp
I was not able to reproduce this, however.
$ cd ta<TAB><TAB><TAB><TAB>
$ echo "${PWD@Q}"
$'/home/kerin/tange/tab/\n`/tmp/trip`>'
$ cd ../../../..
$ cd ta<TAB><TAB><TAB><TAB><TAB>
$ echo "${PWD@Q}"
$'/home/kerin/tange/tab/\n`/tmp/trip`>/tmp'
That was with programmable completion disabled (shopt -u progcomp) and the
following directory structure in place.
$ LC_ALL=C find . -mindepth 1 -exec ls -1d --quoting-style=c {} +
"./tab"
"./tab/\n`"
"./tab/\n`/tmp"
"./tab/\n`/tmp/trip`>"
"./tab/\n`/tmp/trip`>/tmp"
"./tab/\n`/tmp/trip`>/tmp/tripwire;\n'@<?[]|~\\"
"./tab/\n`/tmp/trip`>/tmp/tripwire;\n'@<?[]|~\\/tmp"
--
Kerin Millar