From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: D04parameter.ztst crashes if USE_MMAP is not defined
Date: Fri, 1 Mar 2024 18:57:02 +0900 [thread overview]
Message-ID: <C5441006-EB08-4A9F-8E69-5AC70ECE0B78@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAH+w=7aSyJuFASHnKexhn=ffxvygO78vG_af1uV5KEdSBQBF5A@mail.gmail.com>
> 2024/02/29 13:19、Bart Schaefer <schaefer@brasslantern.com>のメール:
>
> However, getting there is a bit questionable:
>
> getvaluearr (v=0x7fffffffd120) at params.c:686
>
> 689 else if (PM_TYPE(v->pm->node.flags) == PM_ARRAY)
> 690 return v->arr = v->pm->gsu.a->getfn(v->pm);
> (gdb) s
> strgetfn (pm=0x5555555ebd95 <fetchvalue+1539>) at params.c:3944
>
> Why is gsu.a->getfn pointed at strgetfn ? I could imagine that does
> the wrong thing from time to time.
Why (PM_TYPE(v->pm->node.flags) == PM_ARRAY) is true here?
I believe the parameter here is 'string'. But didn't we unset it?
If I add 'typeset -p string' to D04:
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1222,6 +1222,7 @@
typeset -T STRING string
print $STRING $string
unset string
+ typeset -p string
STRING=x:y:z
print $STRING $string
STRING=a:b
then it crashes at this 'typeset -p string'. Back trace is:
(gdb) bt
#0 0x0000557c31da6511 in quotedzputs (
s=0x65756e69746e6f63 <error: Cannot access memory at address 0x65756e69746e6f63>, stream=0x154592c1b780 <_IO_2_1_stdout_>) at utils.c:6439
#1 0x0000557c31d6aa57 in printparamvalue (p=0x557c323a3460, printflags=544)
at params.c:5996
#2 0x0000557c31d6b070 in printparamnode (hn=0x557c323a3460, printflags=544)
at params.c:6197
#3 0x0000557c31cf4c81 in bin_typeset (name=0x557c323bb490 "typeset",
argv=0x557c323bb4e8, assigns=0x0, ops=0x7ffd004cecf0, func=0)
at builtin.c:3096
Line 5996 in params.c is in the block 'case PM_ARRAY:'.
(gdb) up 3
#3 0x000055e433bc1c81 in bin_typeset (name=0x55e4359839b8 "typeset",
argv=0x55e435983a10, assigns=0x0, ops=0x7fff8a133e70, func=0)
at builtin.c:3096
3096 paramtab->printnode(hn, printflags);
(gdb) p *hn
$1 = {next = 0x55e43590e870, nam = 0x55e43596aa60 "string", flags = 1}
This means getnode2() at line 3092 (builin.c) can find an array parameter
'string' in paramtab.
Moreover, if I run D04 ('typeset -p' added) with a normal zsh (i.e.
with mmap), then it fails as follows:
@@ -3,6 +3,7 @@
a:b a b
x y z
a:b a b
+typeset -a string=( )
x:y:z
a:b a b
x:y:z
Test ./D04parameter.ztst failed: output differs from expected as shown above for:
So even with mmap, the parameter 'string' is not removed from paramtab...?
next prev parent reply other threads:[~2024-03-01 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 16:23 Jun. T
2024-02-29 2:41 ` Bart Schaefer
2024-02-29 4:19 ` Bart Schaefer
2024-03-01 9:57 ` Jun T [this message]
2024-03-03 5:33 ` Bart Schaefer
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=C5441006-EB08-4A9F-8E69-5AC70ECE0B78@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--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).