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

Re: Possible bug in 5.8



Roman Perepelitsa wrote on Mon, 20 Dec 2021 13:28 +00:00:
> On Mon, Dec 20, 2021 at 2:18 PM Simon Chatterjee <jal@xxxxxxxxxx> wrote:
>>
>> Zsh 5.8 seems to have a problem with the variable ‘i’, in a ‘for … in’
>> loop, where an item being iterated over starts with a ‘/‘:
>>
>> % zsh --version
>> zsh 5.8 (x86_64-pc-linux-gnu)
>> % for p in /; do echo $p; done
>> /
>> % for i in /; do echo $i; done
>> zsh: bad math expression: operand expected at `/‘
>
> Works fine for me:
>
>   % docker run --rm zshusers/zsh:5.8 zsh -c 'for i in /; do echo $i; done'
>   /
>
> Try reproducing this from `zsh -f`. If you cannot, run `typeset -p i`
> in your shell. You'll probably see that it's defined. Since `zsh -f`
> doesn't have this parameter, it must be defined in rc files.

So, run «zsh -x» and look for «i» in the trace output (as a whole word).

You could try your luck with «zsh -o WARN_CREATE_GLOBAL».  It won't help
if someone _deliberately_ made «i» global, but it would catch implicit
creations of a global integer parameter (e.g., in arithmetic contexts).

The way to report bug is to post them to this list.




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