On Thu, Aug 8, 2013 at 11:40 PM, Cedric Blancher
Post by Cedric Blancherksh (ast-ksh.20130807) crashes on my Fedora laptop if I try to copy
ksh -c 'compound c ; compound -a c.car; integer c.cari=0; trap
"typeset -c c.car[\$((c.cari++))]=.sh.sig" USR1; kill -q4 -s USR1 $$;
kill -q5 -s USR1 $$; true ; print -v c'
Segmentation fault
(I don't have a usable stack trace because this is an optimized build.
Roland, could to have a look please?)
The stacktrace looks like this:
-- snip --
$ cat test1.sh
compound c
compound -a c.car
integer c.cari=0
trap 'typeset -c c.car[$((c.cari++))]=.sh.sig' USR1
kill -q4 -s USR1 $$
kill -q5 -s USR1 $$
true
print -v c
$ gdb --args ./arch/linux.i386-64/bin/ksh test1.sh
GNU gdb (GDB) SUSE (7.5.1-2.1.1)
[snip]
(gdb) run
Starting program:
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/arch/linux.i386-64/bin/ksh
test1.sh
Program received signal SIGUSR1, User defined signal 1.
0x00007ffff735f402 in __sigqueue (pid=55174, sig=10, val=...) at
../sysdeps/unix/sysv/linux/sigqueue.c:46
46 return INLINE_SYSCALL (rt_sigqueueinfo, 3, pid, sig,
__ptrvalue (&info));
(gdb) cont
Continuing.
Program received signal SIGUSR1, User defined signal 1.
0x00007ffff735f402 in __sigqueue (pid=55174, sig=10, val=...) at
../sysdeps/unix/sysv/linux/sigqueue.c:46
46 return INLINE_SYSCALL (rt_sigqueueinfo, 3, pid, sig,
__ptrvalue (&info));
(gdb) cont
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x00000000005227ad in vmregion (addr=0x7ffff7f1dfe0) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/lib/libast/vmalloc/vmbest.c:1105
1105 if(SGHOLD(seg,blk) && (pack =
(Pack_t*)PACK(blk)) && pack->best == (Vmbest_t*)vmdt )
(gdb) where
#0 0x00000000005227ad in vmregion (addr=0x7ffff7f1dfe0) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/lib/libast/vmalloc/vmbest.c:1105
#1 0x000000000051e9cb in _ast_free (data=0x7ffff7f1dfe0) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/lib/libast/vmalloc/malloc.c:740
#2 0x000000000044655e in _nv_unset (np=0x7ffff7f21138, flags=1) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/name.c:2658
#3 0x000000000044c50f in outval (name=0x7ffff7f18e1a "addr",
vname=0x7ffff7f18e11 "c.car[1].addr", wp=0x7fffffffc8d0)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/nvtree.c:873
#4 0x000000000044d56b in genvalue (argv=0x7ffff7f18f50,
prefix=0x7ffff7f18df0 "c.car[1]", n=0, wp=0x7fffffffc8d0)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/nvtree.c:1102
#5 0x000000000044e0b1 in walk_tree (np=0x7ffff7f297b0, xp=0x0,
flags=1) at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/nvtree.c:1267
#6 0x000000000044e488 in put_tree (np=0x7ffff7f297b0, val=0x0,
flags=0, fp=0x7ffff7f1ce80)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/nvtree.c:1338
#7 0x0000000000494140 in nv_putv (np=0x7ffff7f297b0, value=0x0,
flags=0, nfp=0xa) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/nvdisc.c:152
#8 0x0000000000443dd5 in nv_putval (np=0x7ffff7f297b0, string=0x0,
flags=0) at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/name.c:1688
#9 0x00000000004a5365 in array_putval (np=0x7ffff7f29690, string=0x0,
flags=0, dp=0x7ffff7f1d3c0)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/array.c:670
#10 0x0000000000494140 in nv_putv (np=0x7ffff7f29690, value=0x0,
flags=0, nfp=0xa) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/nvdisc.c:152
#11 0x00000000004463d7 in _nv_unset (np=0x7ffff7f29690, flags=0) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/name.c:2623
#12 0x0000000000448390 in nv_rename (np=0x7ffff7f29690, flags=512) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/name.c:3400
#13 0x000000000048ffd8 in setall (argv=0x7ffff7f18c70, flag=512,
troot=0x7ffff7ede3a0, tp=0x7fffffffcf00)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/bltins/typeset.c:725
#14 0x000000000048f032 in b_typeset (argc=3, argv=0x7ffff7f18c68,
context=0x8047c0 <sh+1376>)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/bltins/typeset.c:458
#15 0x0000000000468e5d in sh_exec (shp=0x804260 <sh>,
t=0x7ffff7f18b90, flags=4) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/xec.c:1360
#16 0x000000000047236c in sh_eval_20120720 (shp=0x804260 <sh>,
iop=0x7ffff7edc650, mode=0)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/xec.c:4148
#17 0x00000000004160a3 in sh_trap_20120720 (shp=0x804260 <sh>,
trap=0x7ffff7f1ce40 "typeset -c c.car[$((c.cari++))]=.sh.sig", mode=0)
at /home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/fault.c:862
#18 0x0000000000414fe4 in sh_chktrap (shp=0x804260 <sh>) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/fault.c:500
#19 0x000000000046ea91 in sh_exec (shp=0x804260 <sh>,
t=0x7ffff7f18830, flags=4) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/xec.c:2960
#20 0x000000000040f503 in exfile (shp=0x804260 <sh>,
iop=0x7ffff7edc4d0, fno=11) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/main.c:603
#21 0x000000000040e74e in sh_main (ac=2, av=0x7fffffffe1c8,
userinit=0x0) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/main.c:375
#22 0x000000000040d921 in main (argc=2, argv=0x7fffffffe1c8) at
/home/test001/work/ast_ksh_20130807/build_i386_64bit_debug/src/cmd/ksh93/sh/pmain.c:45
(gdb) print pack
$3 = (Pack_t *) 0xa
-- snip --
... this may be caused by "typeset -c" because it doesn't like .sh.sig ... ;-/
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)