Hi AST users, Anyone have any suggestions to resolve this issue?
Thank you Mike Nemeth Global Engineering Systems *[email protected] ______________________________________________ From: Nemeth, Michael Kenneth (Mike) Sent: Monday, January 26, 2009 11:35 AM To: [email protected] Subject: Ksh93 t Issue ? Hi AST developers, I have a ksh application that's using ksh 93t version: echo ${.sh.version} Version M 93t 2008-11-04 Compiled on: Redhat Enterprise 4.0 Linux Linux pacelab2 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_64 GNU/Linux The application is composed of a number of user defined ksh functions that are . (dotted) when the application is run. The application eventually brings the user back to the ksh prompt. The end user then has the ability to run commands and run the previously dotted in functions. The user also runs scripts that take advantage of the dotted in functions. Since the FPATH is established parent ksh and exported, subshell gains access to the functions and loads them on demand prior to execution. All this ran fine with previous versions of ksh93 and last used ksh93 s+ echo ${.sh.version} Version M 1993-12-28 s+ 1. Sample test script: $ cat testKBask #!/home/mknemeth/ast2/arch/linux.i386-64/bin/ksh x=$(KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE}) echo $x 2. KTask is one of the user built in functions. It calls some other user built in functions to do it's job. It looks something like this function KTask { blockEnv unalias read print modName push KTask typeset kbResponse="" typeset answer="" typeset rStat="1" if [[ $(msglev) = "trace" ]] ; then set -x else echo "here" > here fi #kbResponse=$(eval kbase ${*}) kbResponse=$(kbase ${*}) echo "here 2" >> here # parse return string format of "int:string" rStat="${kbResponse%%:*}" # left of colon answer="${kbResponse#*:}" # right of colon echo "here 3" >> here decho "KTASK RETURN VALUES: stat=($rStat) , txt=($answer)" #\eval \print \"${answer}\" # eval expands sh vars in answer \print \"${answer}\" # eval expands sh vars in answer modName pop unblockEnv echo "here 4" >> here return ${rStat} } 3. The above result with a memory fault with a stack trace as follows for ksh93 t: GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/tls/libthread_db.so.1". warning: core file may not match specified executable file. Core was generated by `/home/mknemeth/ast2/arch/linux.i386-64/bin/ksh testKBask'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib64/libdl.so.2...done. Loaded symbols for /lib64/libdl.so.2 Reading symbols from /lib64/tls/libm.so.6...done. Loaded symbols for /lib64/tls/libm.so.6 Reading symbols from /lib64/tls/libc.so.6...done. Loaded symbols for /lib64/tls/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 #0 0x0000000000446198 in table_unset (root=0x673c30, fun=1) at /home/mknemeth/ast2/src/cmd/ksh93/sh/subshell.c:388 388 if(fun && np->nvalue.rp->fname && *np->nvalue.rp->fname=='/') <-- Memory fault location in source code (gdb) where #0 0x0000000000446198 in table_unset (root=0x673c30, fun=1) at /home/mknemeth/ast2/src/cmd/ksh93/sh/subshell.c:388 #1 0x0000000000446ef5 in sh_subshell (t=0x65c490, flags=5, comsub=1) at /home/mknemeth/ast2/src/cmd/ksh93/sh/subshell.c:634 #2 0x0000000000428e07 in comsubst (mp=0x652080, t=0x65c490, type=1) at /home/mknemeth/ast2/src/cmd/ksh93/sh/macro.c:1950 #3 0x000000000042599c in varsub (mp=0x652080) at /home/mknemeth/ast2/src/cmd/ksh93/sh/macro.c:1081 #4 0x0000000000424119 in copyto (mp=0x652080, endch=0, newquote=0) at /home/mknemeth/ast2/src/cmd/ksh93/sh/macro.c:581 #5 0x0000000000422900 in sh_mactrim (shp=0x64bfa0, str=0x65c3e1 "x=$(KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE})", mode=-1) at /home/mknemeth/ast2/src/cmd/ksh93/sh/macro.c:172 #6 0x000000000042b04b in nv_setlist (arg=0x65c3d0, flags=131584) at /home/mknemeth/ast2/src/cmd/ksh93/sh/name.c:325 #7 0x000000000044aae1 in sh_exec (t=0x65c420, flags=4) at /home/mknemeth/ast2/src/cmd/ksh93/sh/xec.c:802 #8 0x0000000000407ec0 in exfile (shp=0x64bfa0, iop=0x66f390, fno=10) at /home/mknemeth/ast2/src/cmd/ksh93/sh/main.c:589 #9 0x0000000000407488 in sh_main (ac=2, av=0x7fbfffe9e8, userinit=0) at /home/mknemeth/ast2/src/cmd/ksh93/sh/main.c:364 #10 0x00000000004067c2 in main (argc=2, argv=0x7fbfffe9e8) at /home/mknemeth/ast2/src/cmd/ksh93/sh/pmain.c:46 4. Tried to examine the code to determine issue. See information from frame 1 below (gdb) down #1 0x0000000000446ef5 in sh_subshell (t=0x65c490, flags=5, comsub=1) at /home/mknemeth/ast2/src/cmd/ksh93/sh/subshell.c:634 634 table_unset(sp->sfun,1); (gdb) print shp $27 = (Shell_t *) 0x64bfa0 (gdb) print * shp $28 = {options = {v = {4398047690752, 0, 0, 0}}, var_tree = 0x65e7c0, fun_tree = 0x660740, alias_tree = 0x65f750, bltin_tree = 0x6606a0, topscope = 0x64c2f0, inlineno = 55, exitval = 0, trapnote = 0 '\0', subshell = 1 '\001', shcomp = 0 '\0', st = {prevst = 0x0, dolc = 0, dolv = 0x7fbfffe9f0, cmdname = 0x66d2b0 "testKBask", filename = 0x66d310 "/home/mknemeth/ksh93t/testKBask", funname = 0x0, lineno = 54, save_tree = 0x65e7c0, self = 0x64c2f0, var_local = 0x0, staklist = 0x0, states = 4, breakcnt = 0, execbrk = 0, loopcnt = 0, firstline = 0, optindex = 1, optnum = 0, tmout = 0, optchar = 0, opterror = 0, ioset = 0, trapmax = 0, trap = {0x0, 0x0, 0x0, 0x0, 0x0}, trapcom = 0x65be00, otrapcom = 0x0, timetrap = 0x0, real_fun = 0x0}, lim = { arg_max = 131072, open_max = 1024, clk_tck = 100, child_max = 999, ngroups_max = 65536, posix_version = 0 '\0', posix_jobcontrol = 1 '\001', fs3d = 0 '\0'}, stk = 0x648c80, heredocs = 0x0, funlog = 0x0, fdptrs = 0x652ff0, savexit = 1, lastarg = 0x660e50 "testKBask", lastpath = 0x0, path_err = 0, track_tree = 0x65f7f0, var_base = 0x65e7c0, namespace = 0x0, last_table = 0x0, prev_table = 0x0, outpool = 0x659070, timeout = 0, curenv = 1, jobenv = 0, infd = 10, nextprompt = 1, bltin_nnodes = 63, bltin_nodes = 0x65d9e0, bltin_cmds = 0x65f890, posix_fun = 0x0, outbuff = 0x659540 "", errbuff = 0x65b550 "", prompt = 0x0, shname = 0x66d280 "testKBask", shpath = 0x6686b0 "/home/mknemeth/ast2/arch/linux.i386-64/bin/ksh", user = 0x0, comdiv = 0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>, prefix = 0x0, jmplist = 0x7fbfffe670, sigmsg = 0x65c080, oldexit = 1, userid = 37346, euserid = 37346, groupid = 37346, egroupid = 37346, pid = 17997, bckpid = 0, cpid = 0, spid = 17998, ppid = 17113, topfd = 0, sigmax = 64, savesig = 0, sigflag = 0x65c020 "", intrap = 0 '\0', login_sh = 0 '\0', lastbase = 0 '\0', forked = 0 '\0', binscript = 0 '\0', deftype = 0 '\0', funload = 0 '\0', used_pos = 0 '\0', universe = 0 '\0', winch = 0 '\0', indebug = 0 '\0', lastsig = 0 '\0', readscript = 0x0, inpipe = 0x0, outpipe = 0x0, cpipe = {-1, -1}, coutpipe = -1, inuse_bits = 0, envlist = 0x0, arglist = 0x0, fn_depth = 0, fn_reset = 0, dot_depth = 0, hist_depth = 0, xargmin = 0, xargmax = 0, xargexit = 0, nenv = 0, mask = 18, nforks = 1, env = 0x0, init_context = 0x65d3c0, mac_context = 0x652080, lex_context = 0x652120, arg_context = 0x6520d0, ed_context = 0x652200, job_context = 0x0, pathlist = 0x6712f0, defpathlist = 0x0, cdpathlist = 0x0, argaddr = 0x0, optlist = 0x0, global = {prevst = 0x0, dolc = 0, dolv = 0x7fbfffe9f0, cmdname = 0x66d2b0 "testKBask", filename = 0x66d310 "/home/mknemeth/ksh93t/testKBask", funname = 0x0, lineno = 54, save_tree = 0x65e7c0, self = 0x64c2f0, var_local = 0x0, staklist = 0x0, states = 4, breakcnt = 0, execbrk = 0, loopcnt = 0, firstline = 0, optindex = 1, optnum = 0, tmout = 0, optchar = 0, opterror = 0, ioset = 0, trapmax = 0, trap = {0x0, 0x0, 0x0, 0x0, 0x0}, trapcom = 0x65be00, otrapcom = 0x0, timetrap = 0x0, real_fun = 0x0}, checkbase = {buff = {{__jmpbuf = {0, 548682066160, 5126832, 548682066400, 0, 0, 548682065872, 4221369}, __mask_was_saved = 0, __saved_mask = {__val = {0 <repeats 16 times>}}}}, prev = 0x0, topfd = 0, mode = 12, olist = 0x0, err = {context = 0x0, errors = 0, flags = 0, line = 0, warnings = 0, file = 0x0, id = 0x66d2b0 "testKBask"}}, userinit = 0, bltinfun = 0, bltindata = { shp = 0x64bfa0, ptr = 0x0, version = 20071012, shrun = 0x44f328 <sh_run>, shtrap = 0x40cd07 <sh_trap>, shexit = 0x40d05a <sh_exit>, shbltin = 0x46fb48 <sh_addbuiltin>, notify = 0 '\0', sigset = 0 '\0', nosfio = 0 '\0', bnode = 0x65fbd8, vnode = 0x0, data = 0x0, flags = 0, shgetenv = 0x432212 <getenv>, shsetenv = 0x432329 <_ast_setenviron>, invariant = 2}, waitevent = 0, cur_line = 0x0, rcfile = 0x0, login_files = 0x64c930, offsets = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, sftable = 0x655000, fdstatus = 0x652be0 "3", pwd = 0x666400 "/home/mknemeth/ksh93t", hist_ptr = 0x0, jmpbuffer = 0x64c3c0, mktype = 0x0, strbuf = 0x6526c0, strbuf2 = 0x0, last_root = 0x672f60, prev_root = 0x0, fpathdict = 0x674a00, typedict = 0x660930, ifstable = "\000\000\000\000\000\000\000\000\000\001\003", '\0' <repeats 21 times>, "\001", '\0' <repeats 222 times>, sigruntime = "\"@", test = 0, offoptions = {v = {0, 0, 0, 0}}, glob_options = {v = {4398047690752, 0, 0, 0}}, typeinit = 0x0, stats = 0x660d60, nvfun = {disc = 0x0, nofree = 1 '\001', subshell = 0 '\0', dsize = 0, next = 0x0, last = 0x64bfa0 "", type = 0x0}} (gdb) print subenv $29 = 2 (gdb) print subshell $30 = 1 (gdb) print buff $31 = {buff = {{__jmpbuf = {6602656, 548682061136, 5126832, 548682066400, 0, 0, 548682060320, 4483010}, __mask_was_saved = 0, __saved_mask = {__val = {6754832, 548682060848, 4326864, 0, 12884901888, 4294967295, 6669480, 6669600, 6589568, 0, 21474836480, 6627616, 6602656, 548682060880, 4430595, 6602656}}}}, prev = 0x7fbfffe670, topfd = 0, mode = 9, olist = 0x0, err = {context = 0x0, errors = 0, flags = 0, line = 54, warnings = 0, file = 0x0, id = 0x66d2b0 "testKBask"}} (gdb) print argsav $32 = (struct dolnod *) 0x0 (gdb) print subshell_data $33 = (struct subshell *) 0x7fbfffd460 (gdb) print shp->pathlist $34 = (void *) 0x6712f0 (gdb) $35 = (void *) 0x6712f0 (gdb) print shp $36 = (Shell_t *) 0x64bfa0 (gdb) print (char*) shp->pathlist $38 = 0x6712f0 "\200\023g" (gdb) print *(Pathcomp_t*)shp->pathlist $39 = {next = 0x671380, refcount = 1, dev = 2051, ino = 2763489, mtime = 1232980501, name = 0x671348 "/tmp/icds.mknemeth.17113", lib = 0x0, blib = 0x0, bltin_lib = 0x0, len = 24, flags = 1, shp = 0x64bfa0} (gdb) print comsub $40 = 1 (gdb) print jmpval $41 = 9 (gdb) print sp $42 = (struct subshell *) 0x7fbfffd460 (gdb) print *sp $43 = {shp = 0x64bfa0, prev = 0x0, pipe = 0x7fbfffd460, var = 0x65e7c0, svar = 0x0, sfun = 0x673c30, salias = 0x0, pathlist = 0x6712f0, errcontext = 0x7fbfffd400, options = {v = {4398047690752, 0, 0, 0}}, subpid = 17998, saveout = 0x671d90, pwd = 0x671d60 "/home/mknemeth/ksh93t", shpwd = 0x666400 "/home/mknemeth/ksh93t", jobs = 0x6712c0, mask = 18, tmpfd = 11, pipefd = 4, jobcontrol = 0 '\0', monitor = 0 '\0', fdstatus = 0 '\0', fdsaved = 12, sig = 0, bckpid = 0, cpid = 0, coutpipe = -1, cpipe = 0, nofork = 1} (gdb) print *sp->sfun $44 = {searchf = 0x4b69a0 <dttree>, disc = 0x647500, data = 0x673c90, memoryf = 0x4d7870 <dtmemory>, meth = 0x64a8a0, type = 32768, nview = 0, view = 0x0, walk = 0x0, user = 0x0} (gdb) print *sp->sfun->searchf $45 = {void *(Dt_t *, void *, int)} 0x4b69a0 <dttree> (gdb) print *sp->sfun->disc $46 = {key = 16, size = -1, link = 0, makef = 0, freef = 0, comparf = 0x46ce5c <nv_compare>, hashf = 0, memoryf = 0, eventf = 0} (gdb) print *sp->sfun->data $47 = {type = 4, here = 0x673cf0, hh = {_htab = 0x0, _head = 0x0}, ntab = 0, size = 1, loop = 0, minp = 0} (gdb) print *sp->sfun->memoryf $48 = {void *(Dt_t *, void *, size_t, Dtdisc_t *)} 0x4d7870 <dtmemory> (gdb) print *sp->sfun->meth $49 = {searchf = 0x4b69a0 <dttree>, type = 4} 5. The memory fault problem does not occur in the test script if the command is not run within the x=$(... cmd...) syntax #!/home/mknemeth/ast2/arch/linux.i386-64/bin/ksh KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE} #x=$(KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE}) #echo $x 6. The following memory faults just a x=$(...cmd..) #!/home/mknemeth/ast2/arch/linux.i386-64/bin/ksh x=`KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE}` echo $x 7. The following works fine #!/home/mknemeth/ast2/arch/linux.i386-64/bin/ksh KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE} x=$(KTask getInstallDir calibr...@merge ${ICDS_SYS_TYPE}) echo $x I would appreciate any assistance in determining if this a ksh 93 bug or some other known issue. Thank you! Mike Nemeth Global Engineering Systems *[email protected] * Office 610 712 8106 * Cell 610 653 8847
<<inline: Picture (Metafile) 1.jpg>>
<<inline: Picture (Metafile) 2.jpg>>
_______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
