Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Another alias-related crash



Peter Stephenson wrote on Fri, 21 Sep 2018 16:14 +0100:
> This code is particularly complicated owing to having to decide between
> 
> $(( $(echo stuff) ))
> 
> --- mathematical evaluation --- and
> 
> $(( $(echo stuff)); more stuff)
> 
> --- command substitution with a subshell inside, which as far as I can
> see is valid syntax.  Although the alias bug isn't directly related, I
> think it shows up here because of the particularly active use of the
> input stack while the shell is deciding what's going on.
> 
> Would strongly advise NOT doing completion in that sort of code.

Can we *prevent* completion from being used in such code?  I.e., detect
that we're in a Schrödinger's «$((» and simply error out without
attempting to figure out what syntactical position we're generating
completions at?

I suspect that would be non-trivial (since IIRC completion and the
parser don't talk much to each other), but if it's possible it sounds
like it'd be an improvement.

> The resulting bus smash of hard to understand bits of the shell could
> make the quantum vacuum unstable.  (Sort of "off mass shell".
> Physicists' joke, sort of.)

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author