tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sh(1) BUGS entry query



On Mon, Apr 30, 2018 at 8:56 PM, Michael van Elst <mlelstv%serpens.de@localhost> wrote:
> joerg%bec.de@localhost (Joerg Sonnenberger) writes:
>
>>touch 'foo bar'
>>ls foo<TAB>
>
> Pressing TAB after foo yields:
>
> $ touch 'foo bar'
> $ ls foo\ bar
> foo bar
>
> But
>
> $ touch 'foo*bar'
> $ ls foo<TAB><TAB>
> foo bar  foo*bar
> $ ls foo*<TAB>bar
> foo bar foo*bar
>
> Somewhere sh knows that a space needs quoting but not a '*'. It
> also doesn't understand quotes on input:

I believe this is happening in libedit. Few months back I added
escaping of special characters when doing filename auto-completion. I
missed '*' as one of the special characters, it's a one line fix
(patch below), which I can commit.

Index: filecomplete.c
===================================================================
RCS file: /cvsroot/src/lib/libedit/filecomplete.c,v
retrieving revision 1.48
diff -u -p -r1.48 filecomplete.c
--- filecomplete.c      27 Oct 2017 18:16:09 -0000      1.48
+++ filecomplete.c      30 Apr 2018 15:51:40 -0000
@@ -151,6 +151,7 @@ needs_escaping(char c)
        case '{':
        case '}':
        case '&':
+       case '*':
                return 1;
        default:
                return 0;


> $ rm foo\<SPACE><TAB>
> Display all 411 possibilities? (y or n)
>

I am debugging that one :)

-
Abhinav


Home | Main Index | Thread Index | Old Index