Skip to content
Tcl Source Code Artifact [2b3b630918]
Login

Artifact [2b3b630918]

Artifact 2b3b6309186e36566dd875614e9d71f244a588dc4df8f9743be9b438fef939e3:

Ticket change [2b3b630918] - New ticket [7bad415e3ec8baf4|7bad415e3e] <i>Free-form clock scan reads &quot;+02&quot; as two minutes in 8.6 (backport of [51aa53616067cb63] without semantic predicates); the 9.x fix misreads a zone followed by a number</i>. by kenneth.kienle on 2026-09-03 19:55:01.
D 2026-09-03T19:55:01.966
J assignee nobody
J closer nobody
J cmimetype text/x-markdown
J comment **8.6:\sthe\sbug\sof\s[51aa53616067cb63]\sis\sstill\sthere.**\s`generic/tclGetDate.y`'s\r\nrule\s`zone:\ssign\stUNUMBER`\scomputes\s`-$1*($2\s%\s100\s+\s($2\s/\s100)\s*\s60)`,\sso\r\nevery\ssigned\snumber\sis\shhmm\sand\s`+02`\sis\stwo\s*minutes*.\sThe\stz\sproject's\r\nabbreviations\sfor\szones\swithout\sa\sletter\sname\sare\s`+02`,\s`-03`,\s`+0530`\r\n(hh\sor\shhmm),\sso\sany\szoneinfo-derived\s`%Z`\sof\sthat\sform\sround-trips\r\nwrongly\sthrough\sthe\sfree-form\sscanner,\s7,080\ss\soff\sfor\s`+02`:\r\n\r\n\s\s\s\s%\sclock\sscan\s"2023-11-15\s00:13:20\s+02"\s-gmt\s1\r\n\s\s\s\s1700007080\s\s\s\s\s\s\s\s\s\s;#\sexpected\s1700000000\r\n\s\s\s\s%\sclock\sscan\s"2023-11-15\s00:13:20\s+0200"\s-gmt\s1\r\n\s\s\s\s1700000000\r\n\r\nTcl's\sown\ssuite\scannot\ssee\sit\sbecause\s`tools/tclZIC.tcl`\spads\severy\s`%z`\r\nabbreviation\sto\s`%+03d%02d`;\sa\sbuild\sreading\ssystem\szoneinfo\sfails\r\n`clock-59.2`\son\sexactly\sthis,\swhich\sis\show\s[51aa53616067cb63]\swas\sfound.\r\nThat\sticket\swas\sfixed\sfor\s9.x\sin\s[a37536d4d7]\sand\s[7018ffb43e]\sand\sclosed\r\nwith:\s*"I\sam\sunsure\sI\sshall\sbackport\sit\sto\s8.6,\sbut\sif\syes\stheoretically\r\nit\smay\sbe\spossible\sonly\spartial,\sbecause\sI\sdon't\sknow\searlier\sbison/yacc\r\nversions\ssupport\ssemantic\spredicates."*\s8.6.18\s(2026-05-11)\sshipped\r\nwithout\sit.\sThe\sattached\sbackport\suses\s**no\ssemantic\spredicate**,\sonly\sa\r\nplain\saction,\sso\sit\scompiles\swith\swhatever\sbison\sbuilt\sthe\sshipped\r\n`tclDate.c`.\r\n\r\n**9.x:\sthe\sfix\stakes\sthe\swrong\sdigit\scount\swhen\sa\snumber\sfollows\sthe\r\nzone.**\s`yyDigitCount`\sis\sthe\slexer's\scount\sfor\sthe\s*last*\snumber\sit\sread.\r\nThe\sparser\scannot\sreduce\s`sign\stUNUMBER`\swithout\sa\slookahead\s(the\ssame\r\nprefix\sopens\s`sign\stUNUMBER\stDAY`\sand\sthe\srelative\s`sign\stUNUMBER\sunit`),\r\nand\swhen\sthe\slookahead\sis\sitself\sa\snumber\sthe\scount\salready\sbelongs\sto\r\nit.\sSo\s`nmzone`\sreads\s`+02\s2023-11-15`\sby\s2023's\sfour\sdigits,\sand\sreads\r\n`+0200\s15\sNov\s2023`\sby\s15's\stwo,\swhich\s8.6.18\sgets\sright:\r\n\r\n\s\s\s\s%\sclock\sscan\s"+0200\s15\sNov\s2023\s00:13:20"\s-gmt\s1\r\n\s\s\s\s1699935200\s\s\s\s\s\s\s\s\s\s;#\s9.0.4;\s8.6.18\sreturns\s1700000000\r\n\r\n**Fix**\s(attached\s`clock-freescan-hh-zone-lookahead-safe.patch`,\s30\slines\r\nagainst\score-8-6-branch,\s`tclGetDate.y`\sand\sthe\sshipped\s`tclDate.c`\r\nalike):\sone\sor\stwo\sdigits\sare\shours,\sas\s9.x\srules;\sand\sthe\slexer\skeeps\sthe\r\nprevious\scount\s(`datePrevDigitCount`,\ssaved\sbefore\seach\soverwrite)\sso\sthe\r\naction\scan\schoose\sby\sthe\slookahead's\stoken\stype\s—\s`yychar`,\sbison's\r\ndocumented\saction\svariable,\sagainst\s`tUNUMBER`\sand\s`tISOBASE`,\sthe\stwo\r\ntokens\sthe\snumber\spath\sproduces:\r\n\r\n\s\s\s\sint\sdigits\s=\s(yychar\s==\stUNUMBER\s||\syychar\s==\stISOBASE)\r\n\s\s\s\s\s\s\s\s\s\s\s\s?\syyPrevDigitCount\s:\syyDigitCount;\r\n\s\s\s\syyTimezone\s=\s-$1*(digits\s<=\s2\s?\s$2\s*\s60\s:\s$2\s%\s100\s+\s($2\s/\s100)\s*\s60);\r\n\r\nBoth\scounts\sare\sinitialized\swith\sthe\srest\sof\s`DateInfo`.\sThe\ssame\sidea\r\ntransfers\sto\s9.x's\s`nmzone`.\r\n\r\n**Verification:**\sthe\sattached\s`tcl-tz-repro.tcl`\s(also\son\r\n[832d098fdfec8f004cf1c8e8836f7c335da12d54])\shas\sseven\s`clock\sscan`\schecks:\r\nstock\s8.6.18\sfails\sfour\s(`+02`,\s`-02`,\s`+3`,\sand\s`+02\s2023-…`),\sstock\r\n9.0.4\sfails\stwo\s(`+02\s2023-…`,\s`+0200\s15\sNov\s…`),\spatched\s8.6.18\snone;\r\n`+2\sdays`\sand\s`+14\sdays`\srelatives\sunchanged;\s`clock-59.2`'s\ssix\spairs\r\nround-trip\sagainst\ssystem\szoneinfo;\s`tests/clock.test`\sshows\sno\snew\r\nfailure.\sProposed:\sthe\sseven\slines\sas\sa\s`clock-59.x`\sblock\sbeside\r\n`clock-59.2`.
J foundin 8.6.18,\s9.0.4
J is_private 0
J login kenneth.kienle
J priority 5\sMedium
J private_contact 39c7f150e83208e701f26c9bf329dc8b2f4bc4d1
J resolution None
J severity Important
J status Open
J submitter kenneth.kienle
J subsystem 06.\sTime\sMeasurement
J title Free-form\sclock\sscan\sreads\s"+02"\sas\stwo\sminutes\sin\s8.6\s(backport\sof\s[51aa53616067cb63]\swithout\ssemantic\spredicates);\sthe\s9.x\sfix\smisreads\sa\szone\sfollowed\sby\sa\snumber
J type Bug
K 7bad415e3ec8baf40d087374000fbcbab511689c
U kenneth.kienle
Z a81240ccf65c38bcf223cb7e69df99f5