Tcl Source Code

View Ticket
Login
Ticket UUID: 3518851
Title: Unable to parse Africa/Windhoek Olsen time zone
Type: Bug Version: None
Submitter: bovineone Created on: 2012-04-17 16:52:42
Subsystem: 06. Time Measurement Assigned To: kennykb
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2012-04-18 20:00:06
Resolution: Duplicate Closed By: kennykb
    Closed on: 2012-04-18 12:54:51
Description:
Because the built-in Tcl timezone definitions are frequently lagging current updates, we want to rely on the OS zoneinfo files instead.  However, the internal proc ::tcl::clock::ReadZoneinfoFile (located in library/clock.tcl) seems unable to parse the :Africa/Windhoek timezone Olsen file that is a part of the zoneinfo-2012.c distribution.

To replicate this condition on FreeBSD 8.2, do the following:

1) cd /usr/ports/misc/zoneinfo && make install
2) mv /usr/local/lib/tcl8.5/tzdata /usr/local/lib/tcl8.5/tzdata-OFFLINE
3) echo "clock format [clock seconds] -timezone :Africa/Windhoek" | /usr/local/bin/tclsh8.5

It will emit 'time zone ":Africa/Windhoek" not found' because an error was caught during ReadZoneinfoFile.  All other Olsen files that I've tried appear to be parsed fine.

By using TclX's cmdtrace, I've found that the line in ReadZoneinfoFile that is raising an error is:

key "5" not known in dictionary
while evaluating {dict get {0 LMT 4 SWAT 9 SAST 14 CAT 18 WAST 23 {}} 5}

That corresponds to the line in clock.tcl that reads:

        set abbrev [dict get $abbrevs $abbrInd]

Can someone confirm whether the Africa/Windhoek zonefile is corrupt, or is the clock.tcl making an incorrect assumption about the file format?
User Comments: kennykb added on 2012-04-18 20:00:06:
Duplicate of 3470928

kennykb added on 2012-04-18 19:59:30:
Oops, sorry, had the wrong commit for Windhoek; it was actually http://core.tcl.tk/tcl/info/dc71499520 that fixed the bug.  In any case, it's fixed.

kennykb added on 2012-04-18 19:54:51:

allow_comments - 1

The Windhoek bug it tclZIC was fixed over a year ago; see the commit at http://core.tcl.tk/tcl/info/6ae7178df2

As of today, the Fossil trunk and the tip of the core-8-5-branch contain tzdata2012c (admittedly, this is a couple of weeks late, sorry!) So Casablanca, Damascus, Gaza, Hebron and Port-au-Prince are all up to date.

I recommend that if you need a tzdata change, you first check the Fossil repository to see if it's there.  Tcl *releases* may lag tzdata by a significant amount (we don't try to qualify a Tcl release every time some legislature, somewhere, messes with the clock), but we do try to keep the code repository up to date.

bovineone added on 2012-04-17 23:54:43:
For reference, the Africa/Windhoek zonefile has this information:

$ ls -l /usr/share/zoneinfo/Africa/Windhoek
-r--r--r--  1 root  wheel  1556 Apr  9 10:16 /usr/share/zoneinfo/Africa/Windhoek

$ md5 /usr/share/zoneinfo/Africa/Windhoek
MD5 (/usr/share/zoneinfo/Africa/Windhoek) = 2497beb897d0df019d88cb8fca24f0fb

bovineone added on 2012-04-17 23:52:43:

File Added - 441477: clock-tcl-trace.txt

Attachments: