Skip to content

Fix GDateTime timezone resolution for Illumos

Tim Mooney requested to merge tim.mooney/glib:illumos-timezone into main

See the prior discussion in #2550 (closed) for additional background.

Add zone_identifier_illumos, which is static and only included in the compilation when both __sun and __SVR4 are defined.

Add the call to zone_identifier_illumos after all other OS/distro tests in zone_identifier_unix, so that it's only called as a last-ditch effort.

Update the path for the Olson database in both zone_identifier_unix and zone_info_unix to fall back to using /usr/share/lib/zoneinfo if present.

I've tested that it correctly handles

  • /etc/default/init not present/readable (g_file_get_contents returns false)
  • /etc/default/init readable but no TZ= setting in the file
  • TZ= with no value, including as the only line in the that doesn't end with a newline
  • TZ=something or TZ="something" or TZ='something' as the first line in the file
  • TZ=something or TZ="something" or TZ="something' elsewhere in the file

With this patch in place, the glib:glib+slow / gdatetime tests now pass on Illumos. Without the patch, that test fails in subtest 11, /GDateTime/diff

Closes #2550 (closed)

Merge request reports