Skip to content
Tcl Source Code Artifact [b205f203ff]
Login

Artifact [b205f203ff]

Artifact b205f203ffba5cb68dac17735d18cb5e39a952b992f092bce79457270698d4b7:

Ticket change [b205f203ff] - New ticket [5d5b1052280c976e|5d5b105228] <i>execution trace on nested switch - inconsistent line depending on options</i>. by juliannoble2 on 2025-11-10 08:02:44.
D 2025-11-10T08:02:44.280
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-plain
J comment For\sa\snested\sswitch\sstatement\ssuch\sas\sthe\sone\sbelow,\r\nThe\sreported\sline\sfor\sa\sframe\sof\stype\seval\sduring\san\sexecution\senterstep\strace\sdoes\snot\smatch\sthe\sline\sin\sthe\smatched\sscript,\sfor\sthe\sfirst\s1,\s2\sor\s3\spattern\sscripts.\r\n\r\nThis\sis\snot\srelated\sto\sthe\ssource\sfile\slines\s-\sas\sthe\ssituation\sarises\swhen\sthe\sproc\shas\sbeen\sloaded\sby\ssome\smeans\ssuch\sthat\ssource\sfile\sline\snumbers\sare\snot\savailable.\r\n(see\stest\sscript\sswitch_test.tcl\sattached)\r\n\r\nIt\sis\salso\sprobably\snot\srelated\sto\sline-continuations\s-\sanother\ssource\sof\sapparent\smismatches,\sas\sthose\shave\snot\sbeen\sused\sin\sthis\stest.\r\n\r\nThis\sissue\soccurs\swhen\spatterns\sand\sscripts\sare\spassed\sas\sa\ssingle\sblock\s-\sit\sdoes\snot\sseem\sto\soccur\swhen\sthe\sseparated\spattern\sscript\sarguments\sare\sused.\r\n\r\nDepending\son\sthe\snumber\sof\soptions\sused\son\sthe\snested\sswitch\s-\sdifferent\sresults\swill\soccur.\r\nUsually\sthe\sfirst\s2\sscript\sblocks\swill\shave\smisreported\sline\snumbers\sin\sall\s'eval'\scallbacks.\r\n\s\s\s\s\r\nThe\sswitch\sstatements\sin\sthe\stest\sscript\sare\sall\sof\sthe\sbasic\sform\sas\sshown\sin\sthe\sscript\sbelow,\r\nthe\sonly\sdifference\sbeing\sthe\soptions\spassed\sbefore\sthe\sstring\sargument.\r\n\r\nIn\sthe\scase\sbelow,\sthe\sline\snumber\sfor\sthe\sreturn\sarms\saa\sand\sab\sare\smisreported\sas\s4\r\nThe\ssubsequent\sarms\sac\sand\sad\sreport\s2\scorrectly,\sand\swhen\sextended\sto\smore\spattern/scripts\sthere\sare\sno\sfurther\sbad\sline\snumbers\s(even\sif\sscript\sblocks\sare\smodified\sto\shave\scomments,\sempty\slines,\sand\smore\scode)\r\nThe\slargest\snumber\sof\sincorrect\sresults\sI\shave\sseen\sis\s3,\sin\sthe\s5\sargument\scase\s(switch\s-exact\s-nocase\s--\s$string\s$patternblock)\r\n\r\nThe\sfact\sthat\ssubsequent\sarms\safter\sthe\sfirst\s2\sor\s3\scan\salways\scorrectly\sreport\sline\snumbers\srelative\sto\sthe\sstart\sof\seach\ssub\sscript,\sand\sthat\sthe\serror\sdoes\snot\soccur\sat\sall\sin\sthe\s2\sargument\scase\s(switch\s$string\s$patternblock)\ssuggests\sto\sme\sthat\sthere\sprobably\sshouldn't\sfundamentally\sbe\sa\sreason\swhy\sthe\sfirst\sarms\scan't\sreport\sline\snumbers\scorrectly.\r\n\r\n\s\r\n\s\s\s\s#3arg:\sone\sswitch\s+\smatchstring\s+\ssingle\spatternscript\sbody\r\n\s\s\s\sproc\sswitch_nested_3arg\s{s}\s{\r\n\s\s\s\s\s\s\s\sset\sch1\s[::tcl::string::index\s$s\s0]\r\n\s\s\s\s\s\s\s\sswitch\s$ch1\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\sa\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sset\sch2\s[::tcl::string::index\s$s\s1]\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sswitch\s\s--\s$ch2\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sa\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\saa\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sb\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\sab\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sc\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\sac\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sd\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\sad\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\sdefault\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sreturn\s_\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s}
J foundin 8.6+
J is_private 0
J login juliannoble2
J priority 5\sMedium
J private_contact 957fdfcd8744611e3fe1f4896c7538b1d9bf47b2
J resolution None
J severity Important
J status Open
J submitter juliannoble2
J subsystem 18.\sCommands\sM-Z
J title execution\strace\son\snested\sswitch\s-\sinconsistent\sline\sdepending\son\soptions
J type Bug
K 5d5b1052280c976ea3d4873c2088e6ec13049472
U juliannoble2
Z c95f396117610046ab4a45c589192a4c