Discussion:
[ast-developers] Crash setting an array whose type contains certain functions.
Dan Douglas
2013-07-22 03:54:10 UTC
Permalink
Hi, This seems to occur when declaring an array with the -a attribute for a type containing certain properties/disciplines.

Gentoo / amd64 / Version AIJM 93v- 2013-07-18

$ gdb -q --args ksh -c 'typeset -T X=(typeset x; function x.get { :; }); X -a xs=((x=yo) (x=jo))'
Reading symbols from /bin/ksh...Reading symbols from /usr/lib64/debug/bin/ksh.debug...done.
done.
(gdb) thread apply all bt full
(gdb) run
Starting program: /bin/ksh -c typeset\ -T\ X=\(typeset\ x\;\ function\ x.get\ \{\ :\;\ \}\)\;\ X\ -a\ xs=\(\(x=yo\)\ \(x=jo\)\)
Program received signal SIGSEGV, Segmentation fault.
0x000000000048fe14 in setall (argv=0x7ffff7f45d68, flag=4325888, troot=0x7ffff7f0b3a0, tp=0x7fffffffc430) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/bltins/typeset.c:545
545 if(*argv[0]=='+')
(gdb) bt full
#0 0x000000000048fe14 in setall (argv=0x7ffff7f45d68, flag=4325888, troot=0x7ffff7f0b3a0, tp=0x7fffffffc430) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/bltins/typeset.c:545
name = 0x61 <Address 0x61 out of bounds>
last = 0x0
nvflags = 655872
r = 0
ref = 0
comvar = 0
iarray = 4194304
shp = 0x7fe2c0 <sh>
#1 0x000000000048f946 in b_typeset (argc=3, argv=0x7ffff7f45d68, context=0x7fe818 <sh+1368>) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/bltins/typeset.c:458
n = 97
flag = 4325888
tdata = {sh = 0x7fe2c0 <sh>, tp = 0x7ffff7f5d210, wctname = 0x0, outfile = 0x0, prefix = 0x0, tname = 0x0, help = 0x0, aflag = 45, pflag = false, cflag = false, argnum = 0, scanmask = 0, scanroot = 0x0, argnam = 0x0, indent = 0, noref = 0}
optstring = 0x58ae80 <sh_opttype> "[-1c?\n@(#)$Id: type (AT&T Labs Research) 2008-07-01 $\n][-author?David Korn <dgk at research.att.com>][-copyright?Copyright (c) 1982-2013 AT&T Intellectual Property][-license?http://www.eclipse.org/org/do"...
ntp = 0x7ffff7f0b9a0
troot = 0x7ffff7f0b3a0
isfloat = false
isshort = false
sflag = false
#2 0x000000000046b6b0 in sh_exec (shp=0x7ffff7f45d68, t=0x420200 <put_lang+333>, flags=5) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/sh/xec.c:1358
scope = 0
save_prompt = 32767
was_nofork = 0
buffp = 0x7ffff7f45de0
was_vi = 0
save_ptr = 0x0
save_data = 0x0
was_gmacs = 0
share = 0
jmpval = 0
was_emacs = 0
bp = 0x7fe818 <sh+1368>
argv = {0x0}
tflags = 3
np = 0x7ffff7f5d1b0
io = 0x0
command = 0
flgs = 12714496
trap = 0x0
nq = 0x0
last_table = 0x0
com = 0x7ffff7f45d70
argn = 3
skipexitset = 0
vexi = 0
was_errexit = 4
errorflg = 4
mainloop = 0
cp = 0x0
comn = 0x7ffff7f45b71 "xs"
execflg2 = 0
ntflag = 0
topfd = 0
execflg = 1
sav = 0x7ffff7f45db0 "xs"
was_interactive = 0
was_monitor = 0
echeck = 1
stkp = 0x7fad80 <_Stak_data>
unpipe = 0
#3 0x000000000046e3cf in sh_exec (shp=0x7ffff7f45d68, t=0x420200 <put_lang+333>, flags=5) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/sh/xec.c:2225
com = 0x0
argn = 32767
skipexitset = 0
vexi = 0
was_errexit = 4
errorflg = 4
mainloop = 32
cp = 0x0
comn = 0x0
execflg2 = 0
ntflag = 0
topfd = 0
execflg = 1
sav = 0x7ffff7f45db0 "xs"
was_interactive = 0
was_monitor = 0
echeck = 0
stkp = 0x7fad80 <_Stak_data>
unpipe = 0
#4 0x000000000041636f in exfile (shp=0x7ffff7f45d68, iop=0x420200 <put_lang+333>, fno=-135220320) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/sh/main.c:603
curtime = 140737488343104
t = 0x7ffff7f45d90
maxtry = 20
tdone = 0
execflags = 37
states = 0
jmpval = 0
buff = {buff = {{__jmpbuf = {140737353127504, -8061281352762882262, 140737353127504, 140737488343648, 0, 0, -8061281353482205398, 8061280798065592106}, __mask_was_saved = 0, __saved_mask = {__val = {0, 176, 8380032, 0, 0, 176, 4305170501912756291, 140737353048064,
562949953421312, 0, 140737353127504, 140737353127504, 1, 8381120, 0, 140737488343040}}}}, prev = 0x7fe6f8 <sh+1080>, topfd = 0, mode = 11, vexi = 0, olist = 0x0, err = {context = 0x0, errors = 0, flags = 0, line = 0, warnings = 0, file = 0x0,
id = 0x7ffff7f599d0 "/bin/ksh"}}
#5 0x0000000000415790 in sh_main (ac=3, av=0x7fffffffd268, userinit=0x0) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/sh/main.c:375
---Type <return> to continue, or q <return> to quit---
name = 0x7fe2c0 <sh> "\001"
iop = 0x7ffff7f09650
statb = {st_dev = 140737488343512, st_ino = 140737354129832, st_nlink = 1, st_mode = 4158539981, st_uid = 32767, st_gid = 0, __pad0 = 0, st_rdev = 140737354111624, st_size = 1, st_blksize = 0, st_blocks = 140733193388033, st_atim = {tv_sec = 140737354129832,
tv_nsec = 0}, st_mtim = {tv_sec = 140737343038888, tv_nsec = 140737488343328}, st_ctim = {tv_sec = 140737344248832, tv_nsec = 0}, __unused = {140737354130688, 140737488343328, 140737488343312}}
i = 0
rshflag = false
command = 0x7ffff7f599d0 "/bin/ksh"
#6 0x0000000000414b15 in main (argc=3, argv=0x7fffffffd268) at /usr/src/debug/app-shells/ksh-93.20130719/src/cmd/ksh93/sh/pmain.c:45
No locals.
--
Dan Douglas
Loading...