[Bash-completion-devel] robustness: var=$(cmd1) cmd2 -<tab>
ville.skytta at iki.fi
Mon Dec 12 21:09:22 UTC 2011
On 12/11/2011 10:48 PM, Raphaël Droz wrote:
> Just found the following bug:
> $ var=$(id) find -<tab>
> bash: eval: line1: syntax error near unexpected « ) »
> bash: eval: line1: `local cmd=id)'
I managed to reproduce this, but only when the completion for "id" has
been already loaded.
> There is a bug from bash (completions from `id` instead of `find`) but
> bash-completion should be more robust to this.
> I didn't dug further but some entry points for variables may probably be
> sanitized (or at least quoted) a bit more.
The attached patch appears to fix it for _parse_help, without breaking
completions for commands from paths containing backslashed chars (e.g.
whitespace) or ones starting with a tilde. _parse_usage is similarly
affected, but I'm not applying this to either because all this mess
starts to have a strong code smell on it. I'm having a hard time
believing that it's really this hard to get stuff to work, are we doing
something wrong? There must be a cleaner way.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Bash-completion-devel