Roland Mainz
2013-07-16 21:19:37 UTC
Hi!
----
The following testcase (which should test the ".unset" discipline
stuff with multi-dimensional type arrays) crashes ast-ksh.2013-06-28
on SuSE 12.3/AMD64/64bit in the ".unset" discipline method because
|shp| is |NULL|:
$ gdb --args ~/bin/ksh -c 'function f { x_t -a x ; x[4][3].i=1 ; } ;
typeset -T x_t=( integer i=0; function unset { printf "gone %d\n" _.i
; } ) ; f'
(gdb) run
Starting program: /home/test001/bin/ksh -c function\ f\ \{\ x_t\ -a\
x\ \;\ x\[4\]\[3\].i=1\ \;\ \}\ \;\ typeset\ -T\ x_t=\(\ integer\
i=0\;\ function\ unset\ \{\ printf\ \"gone\ %d\\n\"\ _.i\ \;\ \}\ \)\
\;\ f
gone 0
Program received signal SIGSEGV, Segmentation fault.
0x0000000000449bb2 in nv_name (np=0x800e80 <_Dtoset>) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3773
3773 if(!(table=shp->last_table) || *np->nvname=='.' ||
table==shp->namespace || np==table)
(gdb) where
#0 0x0000000000449bb2 in nv_name (np=0x800e80 <_Dtoset>) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3773
#1 0x0000000000449930 in nv_name (np=0x7ffff7f300f0) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3731
#2 0x0000000000449c21 in nv_name (np=0x7ffff7f2fe50) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3785
#3 0x0000000000449a26 in nv_name (np=0x7ffff7f2ff50) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3750
#4 0x000000000044219d in nv_create (name=0x7ffff7f2f861 "_.i",
root=0x7ffff7ee2340, flags=933888, dp=0x7fffffff6620)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:962
#5 0x0000000000443939 in nv_open (name=0x7ffff7f2f861 "_.i",
root=0x7ffff7f300f0, flags=409600)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:1418
#6 0x000000000049f6bd in arith (ptr=0x7fffffff69b0,
lvalue=0x7fffffff6890, type=0, n=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/arith.c:363
#7 0x000000000045fdd5 in expr (vp=0x7fffffff69a0, precedence=0) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/streval.c:900
#8 0x000000000046024e in arith_compile (shp=0x803200 <sh>,
string=0x7ffff7f2f861 "_.i", last=0x7fffffff6b20, fun=0x49ebaf
<arith>, emode=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/streval.c:951
#9 0x00000000004604aa in strval (shp=0x803200 <sh>, s=0x7ffff7f2f861
"_.i", end=0x7fffffff6b20, conv=0x49ebaf <arith>, emode=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/streval.c:1000
#10 0x00000000004a02fd in sh_strnum_20120720 (shp=0x803200 <sh>,
str=0x7ffff7f2f861 "_.i", ptr=0x7fffffff6b88, mode=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/arith.c:564
#11 0x000000000048781d in extend (sp=0x800fe0 <_Sfstdout>,
v=0x7fffffffbcc0, fe=0x7fffffffbf50)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/bltins/print.c:862
#12 0x0000000000510e27 in sfvprintf (f=0x800fe0 <_Sfstdout>,
form=0x7ffff7f1dbf7 "\n", args=0x7fffffffbe48)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/lib/libast/sfio/sfvprintf.c:547
#13 0x0000000000504eb6 in sfprintf (f=0x800fe0 <_Sfstdout>, form=0x58db87 "%!")
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/lib/libast/sfio/sfprintf.c:48
#14 0x0000000000485f4c in b_print (argc=-1, argv=0x7ffff7f2f8a0,
context=0x7fffffffc0b0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/bltins/print.c:327
#15 0x000000000048576f in b_printf (argc=3, argv=0x7ffff7f2f890,
context=0x803758 <sh+1368>)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/bltins/print.c:149
#16 0x0000000000468d7f in sh_exec (shp=0x803200 <sh>,
t=0x7ffff7f2f7f0, flags=6) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:1357
#17 0x0000000000471bd7 in sh_funscope_20120720 (shp=0x803200 <sh>,
argn=1, argv=0x7fffffffc978, fun=0x0, arg=0x7fffffffc890, execflg=4)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:4062
#18 0x000000000046fd84 in sh_funct (shp=0x803200 <sh>,
np=0x7ffff7f2cf00, argn=1, argv=0x7fffffffc978, envlist=0x0,
execflg=4)
---Type <return> to continue, or q <return> to quit---
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:3371
#19 0x00000000004703cc in sh_fun_20120720 (shp=0x803200 <sh>,
np=0x7ffff7f2cf00, nq=0x7ffff7f301b0, argv=0x7fffffffc978)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:3444
#20 0x00000000004946c4 in assign (np=0x7ffff7f301b0, val=0x0,
flags=524289, handle=0x7ffff7f30210)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:296
#21 0x0000000000494060 in nv_putv (np=0x7ffff7f301b0, value=0x0,
flags=524289, nfp=0x0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:152
#22 0x000000000044417a in nv_putval (np=0x7ffff7f301b0, string=0x0,
flags=524289)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:1606
#23 0x00000000004a5219 in array_putval (np=0x7ffff7f2ff10, string=0x0,
flags=524289, dp=0x7ffff7f21f80)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/array.c:670
#24 0x0000000000494060 in nv_putv (np=0x7ffff7f2ff10, value=0x0,
flags=524289, nfp=0x0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:152
#25 0x000000000044417a in nv_putval (np=0x7ffff7f2ff10, string=0x0,
flags=524289)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:1606
#26 0x00000000004a5219 in array_putval (np=0x7ffff7f2fe50, string=0x0,
flags=524289, dp=0x7ffff7f21dd0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/array.c:670
#27 0x0000000000494060 in nv_putv (np=0x7ffff7f2fe50, value=0x0,
flags=524289, nfp=0x0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:152
#28 0x0000000000446702 in _nv_unset (np=0x7ffff7f2fe50, flags=524289)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:2537
#29 0x0000000000446372 in table_unset (shp=0x803200 <sh>,
root=0x7ffff7f2fdf0, flags=524289, oroot=0x7ffff7ee2340)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:2453
#30 0x00000000004496ce in sh_unscope (shp=0x803200 <sh>) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3630
#31 0x0000000000471cf7 in sh_funscope_20120720 (shp=0x803200 <sh>,
argn=1, argv=0x7ffff7f1d650, fun=0x0, arg=0x7fffffffd340, execflg=5)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:4071
#32 0x000000000046fd84 in sh_funct (shp=0x803200 <sh>,
np=0x7ffff7f30930, argn=1, argv=0x7ffff7f1d650, envlist=0x0,
execflg=5)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:3371
#33 0x00000000004698a3 in sh_exec (shp=0x803200 <sh>,
t=0x7ffff7f1d5f0, flags=5) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:1556
#34 0x000000000046be1e in sh_exec (shp=0x803200 <sh>,
t=0x7ffff7f1d5f0, flags=5) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:2222
#35 0x000000000040f4e2 in exfile (shp=0x803200 <sh>,
iop=0x7ffff7ee04d0, fno=-1) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/main.c:603
#36 0x000000000040e72d in sh_main (ac=3, av=0x7fffffffe208,
userinit=0x0) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/main.c:375
#37 0x000000000040d901 in main (argc=3, argv=0x7fffffffe208) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/pmain.c:45
(gdb) print shp
$1 = (Shell_t *) 0x0
----
Bye,
Roland
----
The following testcase (which should test the ".unset" discipline
stuff with multi-dimensional type arrays) crashes ast-ksh.2013-06-28
on SuSE 12.3/AMD64/64bit in the ".unset" discipline method because
|shp| is |NULL|:
$ gdb --args ~/bin/ksh -c 'function f { x_t -a x ; x[4][3].i=1 ; } ;
typeset -T x_t=( integer i=0; function unset { printf "gone %d\n" _.i
; } ) ; f'
(gdb) run
Starting program: /home/test001/bin/ksh -c function\ f\ \{\ x_t\ -a\
x\ \;\ x\[4\]\[3\].i=1\ \;\ \}\ \;\ typeset\ -T\ x_t=\(\ integer\
i=0\;\ function\ unset\ \{\ printf\ \"gone\ %d\\n\"\ _.i\ \;\ \}\ \)\
\;\ f
gone 0
Program received signal SIGSEGV, Segmentation fault.
0x0000000000449bb2 in nv_name (np=0x800e80 <_Dtoset>) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3773
3773 if(!(table=shp->last_table) || *np->nvname=='.' ||
table==shp->namespace || np==table)
(gdb) where
#0 0x0000000000449bb2 in nv_name (np=0x800e80 <_Dtoset>) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3773
#1 0x0000000000449930 in nv_name (np=0x7ffff7f300f0) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3731
#2 0x0000000000449c21 in nv_name (np=0x7ffff7f2fe50) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3785
#3 0x0000000000449a26 in nv_name (np=0x7ffff7f2ff50) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3750
#4 0x000000000044219d in nv_create (name=0x7ffff7f2f861 "_.i",
root=0x7ffff7ee2340, flags=933888, dp=0x7fffffff6620)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:962
#5 0x0000000000443939 in nv_open (name=0x7ffff7f2f861 "_.i",
root=0x7ffff7f300f0, flags=409600)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:1418
#6 0x000000000049f6bd in arith (ptr=0x7fffffff69b0,
lvalue=0x7fffffff6890, type=0, n=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/arith.c:363
#7 0x000000000045fdd5 in expr (vp=0x7fffffff69a0, precedence=0) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/streval.c:900
#8 0x000000000046024e in arith_compile (shp=0x803200 <sh>,
string=0x7ffff7f2f861 "_.i", last=0x7fffffff6b20, fun=0x49ebaf
<arith>, emode=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/streval.c:951
#9 0x00000000004604aa in strval (shp=0x803200 <sh>, s=0x7ffff7f2f861
"_.i", end=0x7fffffff6b20, conv=0x49ebaf <arith>, emode=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/streval.c:1000
#10 0x00000000004a02fd in sh_strnum_20120720 (shp=0x803200 <sh>,
str=0x7ffff7f2f861 "_.i", ptr=0x7fffffff6b88, mode=0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/arith.c:564
#11 0x000000000048781d in extend (sp=0x800fe0 <_Sfstdout>,
v=0x7fffffffbcc0, fe=0x7fffffffbf50)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/bltins/print.c:862
#12 0x0000000000510e27 in sfvprintf (f=0x800fe0 <_Sfstdout>,
form=0x7ffff7f1dbf7 "\n", args=0x7fffffffbe48)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/lib/libast/sfio/sfvprintf.c:547
#13 0x0000000000504eb6 in sfprintf (f=0x800fe0 <_Sfstdout>, form=0x58db87 "%!")
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/lib/libast/sfio/sfprintf.c:48
#14 0x0000000000485f4c in b_print (argc=-1, argv=0x7ffff7f2f8a0,
context=0x7fffffffc0b0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/bltins/print.c:327
#15 0x000000000048576f in b_printf (argc=3, argv=0x7ffff7f2f890,
context=0x803758 <sh+1368>)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/bltins/print.c:149
#16 0x0000000000468d7f in sh_exec (shp=0x803200 <sh>,
t=0x7ffff7f2f7f0, flags=6) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:1357
#17 0x0000000000471bd7 in sh_funscope_20120720 (shp=0x803200 <sh>,
argn=1, argv=0x7fffffffc978, fun=0x0, arg=0x7fffffffc890, execflg=4)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:4062
#18 0x000000000046fd84 in sh_funct (shp=0x803200 <sh>,
np=0x7ffff7f2cf00, argn=1, argv=0x7fffffffc978, envlist=0x0,
execflg=4)
---Type <return> to continue, or q <return> to quit---
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:3371
#19 0x00000000004703cc in sh_fun_20120720 (shp=0x803200 <sh>,
np=0x7ffff7f2cf00, nq=0x7ffff7f301b0, argv=0x7fffffffc978)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:3444
#20 0x00000000004946c4 in assign (np=0x7ffff7f301b0, val=0x0,
flags=524289, handle=0x7ffff7f30210)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:296
#21 0x0000000000494060 in nv_putv (np=0x7ffff7f301b0, value=0x0,
flags=524289, nfp=0x0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:152
#22 0x000000000044417a in nv_putval (np=0x7ffff7f301b0, string=0x0,
flags=524289)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:1606
#23 0x00000000004a5219 in array_putval (np=0x7ffff7f2ff10, string=0x0,
flags=524289, dp=0x7ffff7f21f80)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/array.c:670
#24 0x0000000000494060 in nv_putv (np=0x7ffff7f2ff10, value=0x0,
flags=524289, nfp=0x0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:152
#25 0x000000000044417a in nv_putval (np=0x7ffff7f2ff10, string=0x0,
flags=524289)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:1606
#26 0x00000000004a5219 in array_putval (np=0x7ffff7f2fe50, string=0x0,
flags=524289, dp=0x7ffff7f21dd0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/array.c:670
#27 0x0000000000494060 in nv_putv (np=0x7ffff7f2fe50, value=0x0,
flags=524289, nfp=0x0)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/nvdisc.c:152
#28 0x0000000000446702 in _nv_unset (np=0x7ffff7f2fe50, flags=524289)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:2537
#29 0x0000000000446372 in table_unset (shp=0x803200 <sh>,
root=0x7ffff7f2fdf0, flags=524289, oroot=0x7ffff7ee2340)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:2453
#30 0x00000000004496ce in sh_unscope (shp=0x803200 <sh>) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/name.c:3630
#31 0x0000000000471cf7 in sh_funscope_20120720 (shp=0x803200 <sh>,
argn=1, argv=0x7ffff7f1d650, fun=0x0, arg=0x7fffffffd340, execflg=5)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:4071
#32 0x000000000046fd84 in sh_funct (shp=0x803200 <sh>,
np=0x7ffff7f30930, argn=1, argv=0x7ffff7f1d650, envlist=0x0,
execflg=5)
at /home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:3371
#33 0x00000000004698a3 in sh_exec (shp=0x803200 <sh>,
t=0x7ffff7f1d5f0, flags=5) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:1556
#34 0x000000000046be1e in sh_exec (shp=0x803200 <sh>,
t=0x7ffff7f1d5f0, flags=5) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/xec.c:2222
#35 0x000000000040f4e2 in exfile (shp=0x803200 <sh>,
iop=0x7ffff7ee04d0, fno=-1) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/main.c:603
#36 0x000000000040e72d in sh_main (ac=3, av=0x7fffffffe208,
userinit=0x0) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/main.c:375
#37 0x000000000040d901 in main (argc=3, argv=0x7fffffffe208) at
/home/test001/work/ast_ksh_20130628/build_i386_64bit_debug_patched/src/cmd/ksh93/sh/pmain.c:45
(gdb) print shp
$1 = (Shell_t *) 0x0
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)