[Top][All Lists]

[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: Great Big Dot
Subject: Re: `complete -p -- <cmd>` doesn't yield reusable input when "-F" is assigned an invalid identifier
Date: Tue, 29 Jan 2019 20:15:41 -0500

> On Sun, Jan 27, 2019 at 6:14 PM Chet Ramey <address@hidden> wrote:

> > I prefer this behavior, at least to the extent that the function name
> argument to -F can't contain any shell metacharacters.

But it can, and that's the problem. E.g.:

$ complete -F 'meta;char' -- cmd

yields no errors. `complete` is perfectly happy to accept literally any
argument to "-F", it seems. Empty string, multiple words, metacharacters,
you name it---so long as it doesn't contain a null byte, `complete` won't
so much as blink.

This fact *combined* with the fact that `complete -p` doesn't quote it
yields problems. Continuing the above:

$ complete -p -- cmd
==> complete -F meta;char -- cmd

> [...] you would not be able to define a valid shell function with
> that name.

No, but `complete` doesn't care. Surely it should care, right? At the very
least, if `complete -F` isn't going to error, `complete -p` shouldn't spit
out the wrong result.

reply via email to

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