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
- X-seq: zsh-workers 42804
- From: Anssi Palin <Anssi.Palin@xxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: [[ -v a[key] ]] syntax memory leak & undefined associative array keys detected as set
- Date: Fri, 18 May 2018 21:59:59 +0000
- Accept-language: fi-FI, en-US
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Anssi.Palin@xxxxxxxxxxxx;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudomnia.onmicrosoft.com; s=selector1-edu-omnia-fi; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=02TqkMWeoDf5gFxK45+yC5CmbM/G3xB1d2lyf+El764=; b=Ug9erLJ2BX2hmlI+1/oV3maHwm45t0z+Mqdjls0wMXtY4myHipMxLGWMHLFLIlDmbWGjfpMKPt9UIRergyjUHzF1Xzzu4L4PYySygwXSnxfmOIyMie5i8U++pJYNDjmF+En6sSf/lnHBqhEUQwBV8ZOxfU1LuUvAvj3WfjWryZw=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
- Thread-index: AQHT7vMfODQdZCFQAUygFBDTZAVWgw==
- Thread-topic: [[ -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