.
D 2000-10-26T00:43:48
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s934\sBug\nVersion:\s8.1a2\nSubmitDate:\s'1998-12-04'\nLastModified:\s'1998-12-08'\nSeverity:\sCRIT\nStatus:\sClosed\nSubmitter:\swelch\nChangedBy:\sstanton\nRelatedBugIDs:\s796\s\s937\nOS:\sSolaris\nOSVersion:\s2.5\s(sparc)\nMachine:\sOther\nFixedDate:\s'2000-10-25'\nClosedDate:\s'1998-12-08'\n\n\nName:\n\nMike\sIsely\n\n\nExtensions:\n\n(none)\n\n\nCustomShell:\n\nOnly\schanges\smade\sare\sthis\sbug\sfix,\splus\sa\sprevious\schange\sregarding\sa\sbug\sin\susing\svfork()\sin\sthe\sTcl\sexec\scommand\s(already\sreported\sthat\sone).\n\n\nReproducibleScript:\n\n\n#Run\sthis\sscript\sin\sa\sTcl\s8.1a2\stclsh:\s"tclsh8.1\sbreaktcl.sh".\n\n#\n\n#File\sbreaktcl.sh\n\n\nproc\st1trace\s{name1\sname2\sop}\s{\n\n\s\s\s\sputs\s"t1trace\s$name1\s$name2\s$op"\n\n}\n\n\nproc\sthisblowsup\s{\s}\s{\n\n\s\s\s\sglobal\st1var\n\n\s\s\s\sputs\s"t1var\sis\s$t1var"\n\n\s\s\s\sset\st1var\s"Holy\shubcaps\sBatman!\sYou\sflooded\sit!"\n\n#SIGSEGV\shappens\son\snext\sline\n\n\s\s\s\sputs\s"t1var\sis\snow\s$t1var"\n\n}\n\n\nset\st1var\s"hello"\n\ntrace\svariable\st1var\srwu\st1trace\n\nthisblowsup\n\n\nObservedBehavior:\n\nIt\sseems\sthat\sexecuting\sa\sset\sfollowed\sby\sa\sputs\sdisplaying\sthe\ssame\svariable\snamed\sby\sthe\sset\scauses\sa\sspecific\ssequence\sof\sbyte\scode\sto\sbe\scompiled\s/\sexecuted\swhich\smisbehaves\swhen\sthe\svariable\sis\sa\straced\sglobal\sand\syou're\sexecuting\sinside\sa\sproc.\s\sThis\sproblem\sdoes\snot\soccur\sin\stcl\s8.0.\s\sHere's\sthe\soutput\sfrom\sa\s(broken)\srun:\n\n\nisely@ithink$\s~/work/cvs/w1/tcl/bin/tclsh8.1\sbreaktcl.sh\n\nt1trace\st1var\s\sr\n\nt1var\sis\shello\n\nt1trace\st1var\s\sw\n\nSegmentation\sFault(coredump)\n\n\nHere's\sa\sgdb\ssession\swith\sstack\straceback\sfor\sthe\sSIGSEGV:\n\n(gdb)\srun\s~/junk/breaktcl.sh\n\nStarting\sprogram:\s/home/isely/work/cvs/w1/tcl/bin/tclsh8.1\s~/junk/breaktcl.sh\n\nt1trace\st1var\s\sr\n\nt1var\sis\shello\n\nt1trace\st1var\s\sw\n\n\nProgram\sreceived\ssignal\sSIGSEGV,\sSegmentation\sfault.\n\n0x2a528\sin\sCallTraces\s(iPtr=0xd8340,\sarrayPtr=0x0,\svarPtr=0xe3070,\spart1=0x0,\s\n\n\s\s\s\spart2=0x0,\sflags=16)\sat\s./../generic/tclVar.c:3792\n\n(gdb)\swhere\n\n#0\s\s0x2a528\sin\sCallTraces\s(iPtr=0xd8340,\sarrayPtr=0x0,\svarPtr=0xe3070,\s\n\n\s\s\s\spart1=0x0,\spart2=0x0,\sflags=16)\sat\s./../generic/tclVar.c:3792\n\n#1\s\s0x250a4\sin\sTclGetIndexedScalar\s(interp=0xd8340,\slocalIndex=0,\s\n\n\s\s\s\sleaveErrorMsg=1)\sat\s./../generic/tclVar.c:641\n\n#2\s\s0x5b6d8\sin\sTclExecuteByteCode\s(interp=0xd8340,\scodePtr=0xe2de8)\n\n\s\s\s\sat\s./../generic/tclExecute.c:1068\n\n#3\s\s0x30188\sin\sTcl_EvalObj\s(interp=0xd8340,\sobjPtr=0xe4748,\sflags=0)\n\n\s\s\s\sat\s./../generic/tclBasic.c:2587\n\n#4\s\s0x922c8\sin\sTclObjInterpProc\s(clientData=0xe3020,\sinterp=0xd8340,\sobjc=1,\s\n\n\s\s\s\sobjv=0xefffdf50)\sat\s./../generic/tclProc.c:854\n\n#5\s\s0x1c018\sin\sTcl_EvalObjv\s(interp=0xd8340,\sobjc=1,\sobjv=0xefffdf50,\s\n\n\s\s\s\scommand=0xe20ca\s"thisblowsup\\n",\slength=12,\sflags=0)\n\n\s\s\s\sat\s./../generic/tclParse.c:901\n\n#6\s\s0x1c95c\sin\sTcl_Eval2\s(interp=0xd8340,\s\n\n\s\s\s\sscript=0xe1f40\s"\\n#Run\sthis\sscript\sin\sa\sTcl\s8.1a2\stclsh:\s\\"tclsh8.1\sbreaktcl.sh\\".\\n#\\n#File\sbreaktcl.sh\\n\\nproc\st1trace\s{name1\sname2\sop}\s{\\n\s\s\s\sputs\s\\"t1trace\s$name1\s$name2\s$op\\"\\n}\\n\s\\nproc\sthisblowsup\s{\s}\s{\\n\s\s\s\sglobal\st1var\\n\s\s"...,\snumBytes=406,\sflags=0)\sat\s./../generic/tclParse.c:1279\n\n#7\s\s0x7f288\sin\sTcl_EvalFile\s(interp=0xd8340,\s\n\n\s\s\s\sfileName=0xefffe3f4\s"/home/isely/junk/breaktcl.sh")\n\n\s\s\s\sat\s./../generic/tclIOUtil.c:258\n\n#8\s\s0x18e28\sin\sTcl_Main\s(argc=1,\sargv=0xefffe9c8,\s\n\n\s\s\s\sappInitProc=0x18b1c\s<Tcl_AppInit>)\sat\s./../generic/tclMain.c:141\n\n#9\s\s0x18b08\sin\smain\s(argc=2,\sargv=0xefffe9c4)\sat\s./../unix/tclAppInit.c:83\n\n(gdb)\s\n\n\nDesiredBehavior:\n\nThis\sis\sthe\ssame\srun\susing\sa\stcl\s8.0\stclsh:\n\n\nisely@ithink$\stclsh\sbreaktcl.sh\n\nt1trace\st1var\s\sr\n\nt1var\sis\shello\n\nt1trace\st1var\s\sw\n\nt1trace\st1var\s\sr\n\nt1var\sis\snow\sHoly\shubcaps\sBatman!\sYou\sflooded\sit!\n\n\nPatch:\n\nhttp://www.enteract.com/~isely/tclVar.c.patch\n\n\nPatchFiles:\n\ngeneric/tclVar.c\n\n\n\n\nThe\sproblem\sis\sthat\sTclGetIndexedScalar()\sis\srelying\son\svarPtr->name\sto\sretrieve\sthe\svariable\sname.\s\sHowever\sif\svarPtr\sis\sa\slink\s(to\sa\sglobal\svariable\slooked\sup\svia\shash),\sthe\slinked-to\svariable\smay\snot\shave\sa\svariable\sname\sstored\sthere.\s\sThis\sresults\sin\sa\snull-pointer\sderef\sinside\sof\sCallTraces(),\sand\sa\scrash.\s\sThe\ssolution\sis\sto\sretrieve\sand\ssave\svarPtr->name\sbefore\straversing\sany\spossible\slink(s).\s\sIt\sturns\sout\sthat\sTclSetIndexedScalar()\shas\sprecisely\sthe\ssame\sissue\sand\sit's\salready\sbeen\sfixed\sthere.\s\sHmm,\slooks\slike\sa\sfix\sto\scut/pasted\scode.\s\sI\sfixed\sit\sby\spropagating\sthe\ssame\sfix\sfrom\sTclSetIndexedScalar()\sto\sTclGetIndexedScalar().\n\nThe\sreason\swhy\sthis\sonly\sseems\sto\sbreak\safter\sa\sset\scommand\sis\sbecause\sthe\sTCL\scompiler\sappears\sto\sbe\scompiling\svariable\sreferences\stwo\sdifferent\sways.\s\sOne\smethod\sdoesn't\suse\sTclGetIndexedScalar(),\sand\sthis\sis\sthe\smethod\sused\sfor\sthe\sfirst\sputs\sin\smy\stest\scase\sabove.\s\sThe\ssecond\smethod\sseems\sto\sbe\senabled\safter\scompiling\sthe\sset\scommand\sand\sthat\swhen\sthings\sbreak.\n\n
J foundin obsolete:\s8.1a2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title TCL\sSIGSEGV\swhen\saccessing\straced\sglobal\svar\sfrom\sinside\sa\sp
J type Bug
K 217796ffffffffffffffffffffffffffffffffff
U nobody
Z 31543c3da36473d81f321f8225d0eaf1