Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: D04parameter.ztst crashes if USE_MMAP is not defined
- X-seq: zsh-workers 52642
- From: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: D04parameter.ztst crashes if USE_MMAP is not defined
- Date: Fri, 1 Mar 2024 18:57:02 +0900
- Archived-at: <https://zsh.org/workers/52642>
- In-reply-to: <CAH+w=7aSyJuFASHnKexhn=ffxvygO78vG_af1uV5KEdSBQBF5A@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <5A8A5063-D43C-4AD0-A03E-0A5E84259FFA@kba.biglobe.ne.jp> <CAH+w=7aSyJuFASHnKexhn=ffxvygO78vG_af1uV5KEdSBQBF5A@mail.gmail.com>
> 2024/02/29 13:19、Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>のメール:
>
> 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...?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author