From: Anssi Palin <Anssi.Palin@edu.omnia.fi>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: [[ -v a[key] ]] syntax memory leak & undefined associative array keys detected as set
Date: Fri, 18 May 2018 21:59:59 +0000 [thread overview]
Message-ID: <HE1PR05MB183333C4D7750364A8B01D0CD7900@HE1PR05MB1833.eurprd05.prod.outlook.com> (raw)
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.
next reply other threads:[~2018-05-18 22:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 21:59 Anssi Palin [this message]
2018-05-19 8:49 ` Oliver Kiddle
2018-08-08 21:31 ` Anssi Palin
2018-08-08 22:44 ` Joey Pabalinas
2018-08-09 8:30 ` Peter Stephenson
2018-08-09 9:46 ` Sebastian Gniazdowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=HE1PR05MB183333C4D7750364A8B01D0CD7900@HE1PR05MB1833.eurprd05.prod.outlook.com \
--to=anssi.palin@edu.omnia.fi \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).