www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12875] New: [unittest] std.datetime fails: Not a valid tzdata


          Issue ID: 12875
           Summary: [unittest] std.datetime fails: Not a valid tzdata
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Reduced to a test case:

import std.datetime;
import std.exception;
import std.stdio;

void main()
  static void testPZSuccess(string tzName)
    scope(failure) writefln("TZName which threw: %s", tzName);


  auto tzNames = TimeZone.getInstalledTZNames();

  foreach(tzName; tzNames)


Throws with the following error:
TZName which threw: America/Godthab
core.exception.AssertError test.d(17): assertNotThrown failed: TimeException
was thrown: Not a valid tzdata file.
0x44bbcb _enforceValidTZFile
0x44bbcb immutable(std.datetime.PosixTimeZone)
std.datetime.PosixTimeZone.getTimeZone(immutable(char)[], immutable(char)[])
0x44c982 immutable(std.datetime.TimeZone)
[snip backtrace]

The line where the assert occurs:
_enforceValidTZFile(tzFileVersion == '\0' || tzFileVersion == '2');

And indeed when testing the file, it is in version '3' format - so I guess not
$ file /usr/share/zoneinfo/America/Godthab 
/usr/share/zoneinfo/America/Godthab: timezone data, version 3, 5 gmt time
flags, 5 std time flags, no leap seconds, 117 transition times, 5 abbreviation

Here the distribution-specific version of the package tzdata:
tzdata  2014c-0ubuntu0.14.04

Jun 07 2014