Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testTzSys: fix test suite for non-glibc when using TZDIR #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sternenseemann
Copy link

If TZDIR was set to a directory differing from the system timezone
directory, the testTZSys test suite would fail on certain timezones
in certain configurations. We discovered this when building the tz
packaged in nixpkgs on macOS: We would provide our packaged tzdata via
TZDIR, but /usr/share/zoneinfo would still be accessible. Since Apple's
tzdata seem to be outdated, the tests fail consistently. This is because
the tzset(3) implementation of Apple's libSystem is “only”
POSIX-conforming and doesn't support the glibc invention of TZDIR. They
are not alone with this -- musl doesn't support it as well.

To work around this we can use POSIX behavior, however: If TZ is
prefixed with a ':', we can pass an absolute path and rely on the lookup
behavior implemented in tz itself.

Tested this change on macOS (with libSystem) and on NixOS (with glibc). A new release would be neat, so we don't have to carry this patch around for too long.

If TZDIR was set to a directory differing from the system timezone
directory, the testTZSys test suite would fail on certain timezones
in certain configurations. We discovered this when building the tz
packaged in nixpkgs on macOS: We would provide our packaged tzdata via
TZDIR, but /usr/share/zoneinfo would still be accessible. Since Apple's
tzdata seem to be outdated, the tests fail consistently. This is because
the tzset(3) implementation of Apple's libSystem is “only”
POSIX-conforming and doesn't support the glibc invention of TZDIR. They
are not alone with this -- musl doesn't support it as well.

To work around this we can use POSIX behavior, however: If TZ is
prefixed with a ':', we can pass an absolute path and rely on the lookup
behavior implemented in tz itself.
@ysangkok
Copy link

Thank you, I took over the library and merged and released this as part of v0.1.3.6, here is my fork: https://github.com/ysangkok/haskell-tz/commits/master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants