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

[[ -v a[key] ]] syntax memory leak & undefined associative array keys detected as set



Hello,

In workers/41719 I wrote about a memory leak with the (( ${+a[key]} )) syntax. 
While the issue has since been patched I've now noticed that the alternative 
[[ -v a[key] ]] syntax still suffers from the same problem in 5.5.1.

It also seems that post-patch Zsh is incorrectly detecting undefined keys as 
set in empty associative arrays when KSH_ARRAYS is in effect:

$ set -o KSH_ARRAYS
$ typeset -A a
$ if (( ${+a[undefined]} )); then echo 'Should not echo'; fi
Should not echo

Once the array is populated both set and undefined keys are detected correctly. 
The [[ -v a[key] ]] syntax does not appear to be affected in any case 
regardless of KSH_ARRAYS.

Thank you in advance.



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