<i>Clock reads TZif version 3 and 4 zoneinfo files as version 1 - zones with an extended footer lose all their transitions</i>.
by
.
D 2026-09-03T19:46:50.653
J assignee nobody
J closer nobody
J cmimetype text/x-markdown
J comment `library/clock.tcl`'s\s`ReadZoneinfoFile`\sselects\sthe\s64-bit\sdata\sblock\sand\sthe\r\nTZ-string\sfooter\sonly\swhen\sthe\sheader's\sversion\sbyte\sis\sexactly\s`"2"`\r\n(two\ssites).\sRFC\s9636\s(which\sobsoletes\sRFC\s8536)\sdefines\sversions\s`'2'`,\r\n`'3'`\sand\s`'4'`,\seach\sconforming\sto\sthe\sone\sbefore\s(section\s3.1),\sand\ssays\r\nof\sreaders\sin\ssection\s4:\s*"When\sreading\sa\sversion\s2\sor\shigher\sfile,\sreaders\r\nSHOULD\signore\sthe\sversion\s1\sheader\sand\sdata\sblock\sexcept\sfor\sthe\spurpose\sof\r\nskipping\sover\sthem."*\r\n\r\n`zic`\swrites\sversion\s3\swhenever\sa\szone's\sfooter\sneeds\sthe\sTZ-string\r\nextension\sof\ssection\s3.3.2\s(a\stransition\shour\soutside\s0..24),\sand\sversion\s4\r\nfor\sleap-second\stables\swith\sa\struncation\sor\sexpiry.\sIn\stzdata\s2026c,\s12\sof\r\n598\szones\sare\sversion\s3:\sIsrael,\sAsia/Jerusalem,\sAsia/Tel_Aviv\r\n(`M3.4.4/26`),\sAsia/Gaza,\sAsia/Hebron\s(`/50`),\sAmerica/Santiago,\r\nChile/Continental,\sChile/EasterIsland,\sPacific/Easter,\sAmerica/Nuuk,\r\nAmerica/Godthab,\sAmerica/Scoresbysund\s(`M3.5.0/-1`).\r\n\r\nFor\sthose\sfiles\sTcl\sparses\sthe\s32-bit\sblock.\sWith\s`zic`'s\sdefault\s`-b\sslim`\r\noutput\sthat\sblock\sis\sempty,\sso\sthe\szone\sloads\sas\sa\ssingle\sentry,\sLMT\r\nforever;\swith\s`-b\sfat`\sdata\sthe\s32-bit\stransitions\sare\sread\sand\sthe\sfooter\r\nis\slost,\sso\sthe\sbug\sshows\safter\s2037.\sAnything\sreading\sthe\ssystem\szoneinfo\r\n(`--with-tzdata=no`,\sor\sa\szone\snot\sin\sTcl's\sown\stzdata)\sis\saffected.\r\n\r\n\s\s\s\s%\sclock\sformat\s0\s-timezone\s:UTC\s\s\s\s\s\s\s\s\s\s\s\s;#\sload\sthe\sensemble\r\n\s\s\s\s%\s::tcl::clock::LoadZoneinfoFile\sAsia/Jerusalem\r\n\s\s\s\s%\sllength\s$::tcl::clock::TZData(:Asia/Jerusalem)\r\n\s\s\s\s1\r\n\s\s\s\s%\s::tcl::clock::LoadZoneinfoFile\sAsia/Kolkata\s\s\s;#\sa\sversion-2\sfile\r\n\s\s\s\s%\sllength\s$::tcl::clock::TZData(:Asia/Kolkata)\r\n\s\s\s\s8\r\n\r\n**Reproduction\swithout\stzdata:**\sthe\sattached\s`tcl-tz-repro.tcl`\swrites\r\nsynthetic\sTZif\sfiles\sinto\sa\sscratch\szoneinfo\sdirectory\sin\sthe\sshape\sof\r\n`clock-56.1`/`clock-56.2`\s(a\sversion-2\scontrol,\sversion\s3\swith\sfooter\r\n`<-02>2<-01>,M3.5.0/-1,M10.5.0/0`,\sversion\s3\swith\s`IST-2IDT,M3.4.4/26,M10.5.0`,\r\na\sversion-4\sheader),\sprepends\sit\sto\s`::tcl::clock::ZoneinfoPaths`,\sand\r\nformats\s2030-01-11\sand\s2030-07-11\s12:00\sUTC\sthrough\seach.\sStock\s8.6.18\r\nand\s9.0.4\sreturn\sstandard\stime\sfor\ssummer\sin\sall\sthree\snon-control\szones\r\n(`-02`\sfor\s`-01`,\s`IST`\sfor\s`IDT`).\sThe\sscript\salso\scovers\stwo\sother\sclock\r\nbugs\s(separate\stickets);\sthe\sreader\schecks\sare\sthe\sfirst\sblock.\r\n\r\n**Fix**\s(attached\s`clock-tzif-versions-2-and-up.patch`,\s8\slines\sagainst\r\ncore-8-6-branch;\sapplies\sto\smain\sat\sother\soffsets):\r\n\r\n1.\sBoth\sversion\schecks\sread\sthe\s64-bit\sblock\sand\sthe\sfooter\sfor\sany\r\n\s\s\sversion\sfrom\s2\sup\s-\s`[string\sis\sdigit\s-strict\s$version]\s&&\s$version\s>=\s2`\sā\r\n\s\s\sthe\sRFC's\s"2\sor\shigher",\sand\swhat\sglibc\sdoes\s(any\snonzero\sversion\sbyte).\r\n2.\s`ParsePosixTimeZone`'s\stwo\stransition-time\shour\sfields\s(groups\s16\sand\s24)\r\n\s\s\sbecome\s`/\s(\s[-+]?[[:digit:]]{1,3}\s)`\sfor\ssection\s3.3.2's\srange\sof\r\n\s\s\s-167..167.\s`ProcessPosixTimeZone`\salready\sscans\sthe\sfield\swith\s`%d`\sand\r\n\s\s\sadds\sseconds,\sso\sa\snegative\shour\sneeds\sno\sother\schange;\shour\s26\salready\r\n\s\s\sfit\sthe\sold\spattern.\r\n\r\n**Verification:**\sthe\sscript's\sreader\schecks\spass.\sOn\sreal\sdata,\sall\s12\r\nversion-3\szones\sand\s10\sversion-2\scontrols\swere\scompared\swith\sglibc's\r\n`date`\son\sthe\ssame\sinstalled\sfiles\sat\s6,256\sinstants\s(30-day\ssteps\r\n2026ā2045,\shourly\sacross\sthe\sGreenland\sand\sIsrael\s2026\sand\s2031\stransition\r\nweekends):\s0\smismatches.\s`tests/clock.test`\sis\sunchanged\sby\sthe\sfix.\r\n\r\n**Proposed\stests:**\s`clock-56.4`\s(version\s3,\snegative\stransition\shour),\r\n`clock-56.5`\s(version\s3,\shour\s26),\s`clock-56.6`\s(version\s4\sheader).\sThe\r\nscript's\s`tzif`\sprocedure\sbuilds\seach\sfile\sin\sa\sdozen\slines.
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 Minor
J status Open
J submitter kenneth.kienle
J subsystem 06.\sTime\sMeasurement
J title Clock\sreads\sTZif\sversion\s3\sand\s4\szoneinfo\sfiles\sas\sversion\s1\s-\szones\swith\san\sextended\sfooter\slose\sall\stheir\stransitions
J type Bug
K 832d098fdfec8f004cf1c8e8836f7c335da12d54
U kenneth.kienle
Z 87da6a62fd944c19c9960deb89555547