Tcl Source Code

View Ticket
Login
Ticket UUID: 3387109
Title: clock -timezone bug with tzdata files
Type: Bug Created on: 2011-08-06 03:03:31
Submitter: tjsilva Assigned to: kennykb
Subsystem: 06. Time Measurement Severity:
Priority: 5 Medium Last modified: 2011-08-06 03:03:31
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.5.10
Description:
clock.tcl has errors that prevent finding files in the tzdata directory.  The regexp statement in proc LoadTimeZoneFile is incorrect, and prevents loading filenames with "+" in them, such as tzdata/GMT+0 or tzdata/Etc/GMT+5.  The regexp has the same problem with regard to numbers.  The existing code is:
   regexp {^[[.-.][:alpha:]_]+(?:/[[.-.][:alpha:]_]+)*$} $fileName
But should probably be:
   regexp {^[[.-.][:alnum:]_+]+(?:/[[.-.][:alnum:]_+]+)*$} $fileName      <--- added + and changed alpha to alnum
Another problem with LoadTimeZoneFile is that it first checks for TZData(NAME) instead of TZData(:NAME), which is what is set by all the tzdata files, so this code fails, but shouldn't :
   set now [clock sec]
   clock format $now -timezone GMT0     # results in existence of TZData(GMT0)
   clock format $now -timezone :GMT0    # LoadTimeZoneFile should load tzdata/GMT0, which will create TZData(:GMT0), but proc first checks TZData(GMT0)