[swift-corelibs-dev] TimeZone database

Robert Thompson robert.thompson at willowtreeapps.com
Thu Jul 13 11:25:49 CDT 2017


For what it’s worth, a temporary workaround that’s working fine for me is just to create a symlink at /var/db/timezone/zoneinfo to point to /usr/share/zoneinfo on my Sierra machine. Obviously, this may not be a solution one can implement if you don’t fully control the machine in question (CI servers, etc), but it seems to work great for me hacking on swift-corelibs-foundation and running all the tests!

Thanks,
Robert

> On Jul 10, 2017, at 12:01 PM, Tony Parker via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> No solution is imminent - we may need to come up with a more portable workaround.
> 
> - Tony
> 
>> On Jul 10, 2017, at 5:48 AM, Ian Partridge <ian at poncho.org.uk> wrote:
>> 
>> Just picking this up again.. is a solution imminent?  My hack is
>> 
>> diff --git a/CoreFoundation/NumberDate.subproj/CFTimeZone.c
>> b/CoreFoundation/NumberDate.subproj/CFTimeZone.c
>> index 434203ab43..86ab6ecb71 100644
>> --- a/CoreFoundation/NumberDate.subproj/CFTimeZone.c
>> +++ b/CoreFoundation/NumberDate.subproj/CFTimeZone.c
>> @@ -33,6 +33,7 @@
>> #endif
>> #if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED
>> #include <tzfile.h>
>> +#define TZDIR    "/usr/share/zoneinfo"
>> #elif DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
>> #ifndef TZDIR
>> #define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */
>> 
>> which gets the tests running again on Sierra but I guess breaks on High Sierra.
>> 
>> Thanks,
>> Ian
>> 
>> On 6 July 2017 at 16:28, Tony Parker <anthony.parker at apple.com> wrote:
>>> Yes, we’re discussing this one internally too and trying to figure out what
>>> the right answer is. Maybe the best solution for now is to find a good
>>> mechanism to check the underlying version of the OS and split it out into a
>>> function as you suggest.
>>> 
>>> - Tony
>>> 
>>> 
>>> On Jul 6, 2017, at 7:37 AM, Ian Partridge via swift-corelibs-dev
>>> <swift-corelibs-dev at swift.org> wrote:
>>> 
>>> Good shout Simon, you are right.  I'm on Sierra.  Compare and contrast:
>>> 
>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
>>> #define TZDIR   "/usr/share/zoneinfo"
>>> 
>>> /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
>>> #define TZDIR   "/var/db/timezone/zoneinfo"
>>> 
>>> so I guess if I installed the High Sierra beta it would work OK.
>>> 
>>> I hacked CF to force it to use /usr/share/zoneinfo and TestFoundation
>>> is much happier, but that's not a solution.
>>> 
>>> On 6 July 2017 at 15:20, Simon Evans <si at si.org> wrote:
>>> 
>>> Ian
>>> 
>>> I also saw this error, I think its because the TZDIR is different in the
>>> headers shipped with Xcode 9. Maybe the location of the timezone directory
>>> was moved between Sierra and High Sierra. What version of macOS are you
>>> testing on?
>>> 
>>> If it has indeed moved between 10.12 and 10.13 it may require a runtime
>>> version check to dynamically return TZDIR.
>>> 
>>> Simon
>>> 
>>> 
>>> On 6 Jul 2017, at 15:09, Ian Partridge via swift-corelibs-dev
>>> <swift-corelibs-dev at swift.org> wrote:
>>> 
>>> Hi,
>>> 
>>> I'm seeing quite a lot of tests failing when running the
>>> TestFoundation target in Xcode.  The failures are timezone related.
>>> Most simply, the code
>>> 
>>> let timeZone = TimeZone(abbreviation: "GMT")
>>> 
>>> is returning nil.
>>> 
>>> Walking through the CF code which sets things up, it seems to be
>>> trying to read the timezone database from
>>> /var/db/timezone/zoneinfo/zone.tab which doesn't exist on my macOS
>>> system.
>>> 
>>> /usr/share/zoneinfo/zone.tab is there and seems to be the right
>>> location (?), but CF is picking up TZDIR from tzfile.h which says:
>>> 
>>> #define TZDIR   "/var/db/timezone/zoneinfo"
>>> 
>>> Any thoughts?  I feel like I'm missing something obvious and have gone
>>> too far down the rabbit hole.
>>> 
>>> --
>>> Ian Partridge
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Ian Partridge
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Ian Partridge
>> 
>> On 6 July 2017 at 16:31, Tony Parker via swift-corelibs-dev
>> <swift-corelibs-dev at swift.org> wrote:
>>> Yes, we’re discussing this one internally too and trying to figure out what
>>> the right answer is. Maybe the best solution for now is to find a good
>>> mechanism to check the underlying version of the OS and split it out into a
>>> function as you suggest.
>>> 
>>> - Tony
>>> 
>>> 
>>> On Jul 6, 2017, at 7:37 AM, Ian Partridge via swift-corelibs-dev
>>> <swift-corelibs-dev at swift.org> wrote:
>>> 
>>> Good shout Simon, you are right.  I'm on Sierra.  Compare and contrast:
>>> 
>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
>>> #define TZDIR   "/usr/share/zoneinfo"
>>> 
>>> /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tzfile.h
>>> #define TZDIR   "/var/db/timezone/zoneinfo"
>>> 
>>> so I guess if I installed the High Sierra beta it would work OK.
>>> 
>>> I hacked CF to force it to use /usr/share/zoneinfo and TestFoundation
>>> is much happier, but that's not a solution.
>>> 
>>> On 6 July 2017 at 15:20, Simon Evans <si at si.org> wrote:
>>> 
>>> Ian
>>> 
>>> I also saw this error, I think its because the TZDIR is different in the
>>> headers shipped with Xcode 9. Maybe the location of the timezone directory
>>> was moved between Sierra and High Sierra. What version of macOS are you
>>> testing on?
>>> 
>>> If it has indeed moved between 10.12 and 10.13 it may require a runtime
>>> version check to dynamically return TZDIR.
>>> 
>>> Simon
>>> 
>>> 
>>> On 6 Jul 2017, at 15:09, Ian Partridge via swift-corelibs-dev
>>> <swift-corelibs-dev at swift.org> wrote:
>>> 
>>> Hi,
>>> 
>>> I'm seeing quite a lot of tests failing when running the
>>> TestFoundation target in Xcode.  The failures are timezone related.
>>> Most simply, the code
>>> 
>>> let timeZone = TimeZone(abbreviation: "GMT")
>>> 
>>> is returning nil.
>>> 
>>> Walking through the CF code which sets things up, it seems to be
>>> trying to read the timezone database from
>>> /var/db/timezone/zoneinfo/zone.tab which doesn't exist on my macOS
>>> system.
>>> 
>>> /usr/share/zoneinfo/zone.tab is there and seems to be the right
>>> location (?), but CF is picking up TZDIR from tzfile.h which says:
>>> 
>>> #define TZDIR   "/var/db/timezone/zoneinfo"
>>> 
>>> Any thoughts?  I feel like I'm missing something obvious and have gone
>>> too far down the rabbit hole.
>>> 
>>> --
>>> Ian Partridge
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Ian Partridge
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>>> 
>> 
>> 
>> 
>> -- 
>> Ian Partridge
> 
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev



More information about the swift-corelibs-dev mailing list