Skip to content
Tcl Source Code Artifact [b6f59059f8]
Login

Artifact [b6f59059f8]

Artifact b6f59059f8cee1ddf6b560864016ea21ca8a614e:

Ticket change [b6f59059f8] - New ticket [218508ffffffffff|218508ffff] <i>Hash table corruption when rebuildLiteralTable occurs (invo</i>. by nobody on 2000-10-26 01:01:27.
D 2000-10-26T01:01:27
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s765\sBug\nVersion:\s8.1a2\nSubmitDate:\s'1998-10-27'\nLastModified:\s'1998-12-08'\nSeverity:\sSER\nStatus:\sReleased\nSubmitter:\spat\nChangedBy:\sstanton\nRelatedBugIDs:\s764\nOS:\sAll\nOSVersion:\sNA\nMachine:\sNA\nFixedDate:\s'1998-12-08'\nFixedInVersion:\s8.1b1\nClosedDate:\s'2000-10-25'\n\n\nSubject:\sHash\stable\scorruption\swhen\srebuildLiteralTable\s\soccurs\s(invoked\sfrom\sTclRegisterLiteral)\sduring\scompilation\nFrom:\[email protected]\n\nTclTk\sBug\sReport\sForm\sfilled\sout\sby:\s\[email protected]\n\nName:\s\sAdam\sGrove\nBugOrRFE:\s\sBug\nProduct:\s\sTcl\nVersion:\s\s8.1a2\nOperatingSystem:\s\sWinNT\nOperatingSystemVersion:\s\s4.0\nExtensions:\s\snone\nCustomShell:\s\sNone;\sbut\scompiled\swith\sthe\smultithreading\soptions.\s\nSynopsis:\s\sHash\stable\scorruption\swhen\srebuildLiteralTable\s\soccurs\s(invoked\sfrom\sTclRegisterLiteral)\sduring\scompilation\n\nReproducibleScript:\nNot\sreally\spossible.\sThis\sis\sa\svery\stime/situation\sdependent\sbug\swhich\sI\shave\nnot\sbeen\sable\sto\sreduce\sto\sa\ssmall\stest.\s\s\n\nObservedBehavior:\nThe\sobserved\sbehaviour\swas:\n\s\s\s\stcl_deleteinterp\ssometimes\swould\snot\sreturn.\nInvestigation\srevealed\sthat\san\sobject\swas\splaced\sin\sthe\swrong\nbucket\sof\sthe\sglobal\sliteral\stable\s(in\sfile\stclLiteral.c).\sBy\swrong,\sI\smean\sthat\nthe\shash\svalue\sof\sthe\sobject\sdid\snot\scorrespond\stothe\sbucket\sin\swhich\nthe\sobject\sappears.\sWhen\sthis\shappens,\sthe\sobject\sis\snot\ssuccessfully\ndeleted\sand\sso\sthe\sattempt\sto\spurge\sthe\sliteral\stable\sloops\sforever.\s\nThis\sexplains\swhy\stcl_deleteinterp\sfails.\s\n\n\sIt\sturns\sout\sthat\sthe\sobject\swas\splaced\sin\sthe\swrong\sbucket\searlier,\sat\sa\stime\nwhen\sthe\shash\stable\swas\srebuild\s(because\sit\sneeded\sto\sgrow\sin\ssize)\sby\nfunction\srebuildLiteralTable.\nThis\srequest\sto\srebuild\sis\scalled\sfrom\sTclRegisterLiteral.\n\nThe\sobject\swas\sinserted\swrongly\sbecause,\sat\sthe\stime\sof\sthe\srebuild,\nit\shad\sa\snull\scharacter\sinserted\sin\sthe\smiddle.\sThus\sthe\scomputed\nhash\svalue\swas\sinaccurate.\n\nThe\sobject\shad\sa\snull\scharacter\sinserted\sbecause\sit\sseems\sthat\nroutines\sin\stclCompile.c\sdo\sthis\sat\stimes\sto\sstrings\sthey\scompile.\n(I\sdo\snot\sunderstand\sthese\sroutines\svery\swell)\nThat\sis,\sthese\sroutines\ssometime\stemporarily\sinsert\snulls\s(saving\nthe\soverwritten\scharacter)\sso\sthat\sthey\scan\sonly\slook\sat\ssome\nsubstring\swithout\sthe\soverhead\sof\scopying.\s\s\n\nHowever,\sif\sa\scall\sto\sTclRegisterLiteral\sis\smade\swhile\sthis\stemporary\nsubstitution\sis\sin\seffect,\sand\sif\sthis\scall\strigges\sa\srebuild\srequest,\nthe\soriginal\sobject\swill\snot\sbe\shashed\scorrectly.\n\nSo,\sin\ssummary,\s\sthis\sproblem\sarises\sif\sthe\sglobal\sliteral\stable\nreaches\sa\scritical\ssize\s(to\strigger\sa\srebuild)\sat\scertain\spoints\sin\sthe\ncompilation\sprocess.\sThe\seffects\sof\sthis\serror\s(an\sinconsistent\nhash\stable,\swhich\sis\snot,\showever,\scaught\sby\sthe\sdebugging\nchecks\sin\sTclLiteral.c)\scause\sunpredictable\sbehaviour\slater,\sbut\nfor\sme\sthey\smanifested\sin\sthe\sfailure\sof\stcl_deleteinterp.\n\nrebuilds\smust\soccur\sonly\swhen\sall\sobjects\sare\sin\sa\s"good"\sstate,\nand\snot\stemporarily\smodified\sby\sother\sprocedures.\n\nDesiredBehavior:\nObviously,\sthis\sis\sa\sserious\sbug\swhen\sit\sstrikes,\sand\sit\swould\sbe\snice\nto\shave\sit\sfixed.\s\n\nI\sdo\snow\sknow\sTcl\sor\sthe\sTcl\ssource\sat\sall\swell,\sso\sit\sseems\splausible\nto\sme\sthat\sa\ssimilar\stype\sof\serror\smight\sarise\sfor\sthe\svarious\sother\nhash\stables\sthat\sTcl\sseems\sto\suses\sinternally.\s\n\nPatch:\nFor\smy\sown\sinternal\suse,\sI've\smade\sa\sseparate\scall\n\sTclRegisterLiteral_noRebuild(...)\swhich\sis\sjust\slike\nTclRegisterLiteral\sbut\sa\srebuild\sis\snot\striggered\seven\sif\sthe\ssize\slimit\nis\sexceeded.\s(This\sseems\sharmless...there's\ssurely\snothing\nmagic\sabout\sreaching\sthis\slimit\sand\sthe\srebuild\scan\sbe\sdeferred\sso\slong\nas\swe\seventually\sget\sa\schance\sto\srebuild).\s\n\sI've\stried\sto\sguess\sat\swhich\scalles\sin\stclCompile.c\sshould\sbe\sreplaced\nwith\sthis\snew\scall.\sThis\shas\sworked\sfor\sme\s(so\sfar)\sbut\sI\sreally\sdon't\nunderstand\sthe\scode\sat\sall\swell,\sso\shave\sno\sconfidence\sthat\sI\shave\nreally\sfixed\sthis\scorrectly\sand\sefficiently.\s\n\n\n\nThis\sis\srelated\sto\sbug\s764.\s(pat\s10/27/98)\n\nThis\sbug\shas\sbeen\sfixed\sby\savoiding\sdangerous\scalls\swhile\sthe\sstring\sis\smodified.\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 Hash\stable\scorruption\swhen\srebuildLiteralTable\s\soccurs\s(invo
J type Bug
K 218508ffffffffffffffffffffffffffffffffff
U nobody
Z 7eacf35d122373563c6cbd628b0d650f