Now that I have got libical to build on windoze the next problem I found was that the regression test program core dumped. I have the fix, which involves changes to the file icaltimezone.c.

It was blowing up referencing through a null pointer because the routine icaltimezone_parse_zone_tab does not expect icaltzutil_get_zone_directory() or get_zone_directory() to return the null pointer. However, there might be no timezone information directories configured. Looking at this in the debugger revealed that it was going down the code path for UNIX timezone files.  It was calling set_zonedir, which has a list of UNIX directory names in which to look for This is wrong for Windoze, but revealed  icaltimezone_parse_zone_tab does not handle the case of no timezone files. I fixed it by changing the code to look like this:

    const char* zone_dir;

    icalerror_assert (builtin_timezones == NULL,
                      "Parsing file multiple times");

    builtin_timezones = icalarray_new (sizeof (icaltimezone), 32);

    zone_dir = icaltzutil_get_zone_directory();
    if (zone_dir == NULL)
    filename_len = strlen((char *)zone_dir) + strlen (ZONES_TAB_SYSTEM_FILENAME) + 2;
    zone_dir = get_zone_directory();
    if (zone_dir == NULL)
    filename_len = strlen(zone_dir) + strlen (ZONES_TAB_FILENAME) + 2;

With this change in place, the regression test program ran ok. I would be grateful for peoples comments on this fix please. icaltzutil_get_zone_directory seems to expect that returning NULL is ok when there is no timezone directory. Otherwise it would raise an error, right?

I am also puzzled by why it doesn't call get_zone_directory, which has windoze-specific code for locating the directory. It looks like it might be to do with USE_BUILTIN_TZDATA not being defined. Also, it is looking for the file, which does not seem to be in the distribution.


Andrew Marlow
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.

Please refer to  for additional disclosures.