.
D 2016-12-17T14:16:20.206
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment Tcl_LinkVar\sis\snot\stolerant\sto\sminus,\splus,\sdot\r\n\r\nThis\swas\sreported\sprivately\sfirst\sand\spublished\son\sTcl-Core\slist\slater.\sThe\soriginally\sproblem\sreported\sby\sa\suser\sis\sthat\styping\sa\sbare\sminus\ssign\s('-')\sinto\sa\sTk\sentry\s(or\sanything\sexcept\sa\snumber)\swith\sa\s-textvariable\r\n<b>bound\sto\sa\sC\sint\sor\sC\sdouble\svariable</b>\sraises\san\serror\sin\sTcl/Tk\s8.5.19,\swhich\swas\snot\sthe\scase\swith\s8.5.18.\r\n\r\nExample\sof\ssuch\serror:\r\n<verbatim>\r\n##############################################\r\n\s\scan't\sset\s"fthresh":\svariable\smust\shave\sreal\svalue\r\n\s\svariable\smust\shave\sreal\svalue\r\n\s\s\s\s\s\s(write\strace\son\s"fthresh")\r\n\s\s\s\s\s\sinvoked\sfrom\swithin\r\n\s\s"$w\sinsert\sinsert\s$s"\r\n\s\s\s\s\s\s(procedure\s"tk::EntryInsert"\sline\s12)\r\n\s\s\s\s\s\sinvoked\sfrom\swithin\r\n\s\s"tk::EntryInsert\s.display.le.fthresh.e\s-"\r\n\s\s\s\s\s\s(command\sbound\sto\sevent)\r\n##############################################\r\n</verbatim>\r\n\r\nThe\sOP\sC\scode\slooks\slike\sthis:\r\n<verbatim>\r\n##############################################\r\ndouble\sfthresh;\r\nstatic\sTcl_Interp\s*interp;\r\n\r\nint\smain(int\sargc,\schar\s**argv)\r\n{\r\n\s\s\s\s...\r\n\s\s\s\sinterp\s=\sTcl_CreateInterp();\r\n\s\s\s\s...\r\n\s\s\s\sTcl_LinkVar(interp,"fthresh",(char\s*)&fthresh,\sTCL_LINK_DOUBLE);\r\n\s\s\s\s...\r\n}\r\n##############################################\r\n</verbatim>\r\n\r\nAnd\shis\sTcl\scode\slooks\slike\sthis:\r\n<verbatim>\r\n##############################################\r\n\s\s\sentry\s.a\s-textvariable\sfthresh\s...\r\n##############################################\r\n</verbatim>\r\n\r\nA\scomplete\sbug\sreproduction\spackage\s(C\scode,\sTcl\scode\sand\sinstructions\sto\srun\sit)\swas\sprovided\sby\sthe\sOP\sand\sis\sattached\sto\sthe\spresent\sticket.\r\n\r\nInvestigation\sof\sthe\sissue\srevealed\sthat:\r\n\r\n\s\s\s\s1.\sTcl_LinkVar\sdoes\sits\sjob\sthrough\sa\svariable\strace.\r\n\r\n\s\s\s\s2.\sFixing\s[http://core.tcl.tk/tk/info/1700065|Tk\sbug\s1700065]\smade\sthe\sissue\sapparent\sbecause\ssince\sthat\sfix,\swhen\sa\swrite\strace\sis\sset\son\sa\stextvariable\sof\san\sentry,\sand\sthere\sis\san\serror\sin\sthat\swrite\strace\sproc,\sthe\sbehavior\schanged.\sThe\serror\sbecame\sreported\sinstead\sof\sbeing\ssilently\signored.\r\n\r\n\s\s\s\s3.\sThe\sttk::entry\shas\sand\salways\shad\s(AFAIK)\sthis\sissue,\seven\sbefore\sfixing\sTk\sbug\s1700065\s(which\sdid\snot\stouch\sttk::entry\sanyway).\r\n\r\n\s\s\s\s4.\sProblem\sis\snot\slimited\sto\sinserting\sa\sbare\sminus\s(-)\ssign,\sit\shappens\swhen\sinserting\sa\sbare\splus\s(+)\sor\sdot\s(.)\ssign\sas\swell.\sAll\sbeing\spotentially\srealistic\sactions\syou\scould\swant\sto\sdo\sin\san\sentry\swidget.\r\n\r\n\s\s\s\s5.\sLooking\sin\sthe\sTcl\ssource\scode,\sLinkTraceProc()\ssimply\schecks\sif\sTcl_GetIntFromObj()\sreturns\sTCL_OK\sor\snot.\sAnd\ssimilarly\sfor\sother\stypes\s(wide\sint,\sdouble,\sshort...).\sA\sbare\s-,\s+,\sor\s.\smakes\sthis\scall\sreturn\sTCL_ERROR.\r\n\r\nIn\sconclusion,\sI\sbelieve\sthat\sLinkTraceProc()\scould\sbe\smore\stolerant\sto\swhat\scould\sbe\san\sinteger\sor\sdouble.\r\n\r\nDonald\sArseneau\sproposed\sthe\sfollowing\schange:\r\n\r\n<i>If\sstring\sconverts\sto\sproper\snumeric,\sthen\sapply\svalue\r\n<p>else\sif\sstring\swith\s"0"\sappended\sconverts\sto\sproper\snumeric,\r\n<p>don't\sapply\svalue,\sbut\sdon't\sgive\serror\seither.\r\n<p>else\sraise\serror\r\n</i>
J foundin All
J is_private 0
J login fvogel
J priority 5\sMedium
J private_contact fbd2cca1b0c719fdaddfc7388b5609d917e5fdc5
J resolution None
J severity Minor
J status Open
J submitter fvogel
J subsystem 09.\sLinked\sC\sVariables
J title Tcl_LinkVar\sis\snot\stolerant\sto\sminus,\splus,\sdot
J type Bug
K 39f6304c2e90549c209cd11a7920dc9921b9f48e
U fvogel
Z 89820f70c446755bec94cb96dd4677ca