bug-bash
[Top][All Lists]
Advanced

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

Re: `complete -p -- <cmd>` doesn't yield reusable input when "-F" is ass


From: Chet Ramey
Subject: Re: `complete -p -- <cmd>` doesn't yield reusable input when "-F" is assigned an invalid identifier
Date: Sun, 27 Jan 2019 18:14:11 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3

On 1/24/19 12:24 PM, Great Big Dot wrote:

> Bash Version: 5.0
> Patch Level: 0
> Release Status: release
> 
> 
> Description:
>     According to the manual's section on the `complete` builtin:
> 
>     > "If the -p option is supplied, or if no options are supplied,
>       existing completion specifications are printed in a way that allows
>       them to be reused as input."
> 
>     Unfortunately, there is at least one edge cases that, despite being
>     invalid, are considered valid by `complete`, and the proper measures to
>     deal with it are not taken. Namely:
> 
>     $ complete -F 'bad func' -- cmd        # No error is triggered here...
>     $ complete -p -- cmd                   #
>     => complete -F bad func cmd            # Not quoted!!
> 
>     The expected behavior ought to be either that the first line yields an
>     error (e.g., "bash: `'bad func'': not a valid identifier"), 

I prefer this behavior, at least to the extent that the function name
argument to -F can't contain any shell metacharacters. Since those
characters would have to be quoted when defining the function, and you
can't quote function names when defining the function (at least for the
time being), you would not be able to define a valid shell function with
that name.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]