Skip to content

Resolve macOS timezone names relative to zoneinfo - #56

Open
OskarEichler wants to merge 3 commits into
floraison:masterfrom
OskarEichler:codex/resolve-macos-zoneinfo-path
Open

Resolve macOS timezone names relative to zoneinfo#56
OskarEichler wants to merge 3 commits into
floraison:masterfrom
OskarEichler:codex/resolve-macos-zoneinfo-path

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Extract the IANA name after /zoneinfo/ instead of assuming a fixed number of path components in /etc/localtime's symlink target.

On the inspected macOS installation, the target is /var/db/timezone/zoneinfo/Europe/Istanbul. The current code returns "zoneinfo/Europe/Istanbul", which TZInfo rejects; local detection then falls back to an unrelated zone with matching current offsets.

Reproduction

Before: EtOrbi.osx_tz returns "zoneinfo/Europe/Istanbul"; automatic detection selected Antarctica/Syowa. After: it returns Europe/Istanbul and detection selects that zone.

Checked the actual symlink and temporary readlink substitutions for /usr/share/zoneinfo/Asia/Tokyo and /var/db/timezone/zoneinfo/America/New_York. The traditional path remains supported; a target without a zoneinfo component yields nil for existing fallback handling.

Verification

  • Ruby 4.0.6 via rbenv; existing Probatio suite, no test files added or modified.
  • Reviewed master baseline and this individual patch each run 270 tests / 412 assertions with exactly the same three pre-existing DST/rday failures from rday / rweek calculation is odd in time zones with DST #51. Failure identities were compared, not just counts.
  • A release-based 1.4.1 branch containing the five separately proposed fixes passes 263 existing tests / 405 assertions with TZInfo 2.0.6 in UTC, Asia/Tokyo, America/Chicago, Europe/Istanbul and the detected local zone.
  • Temporary focused before/after reproductions pass with TZInfo 2.0.6 and 1.2.11. The combined release branch also passes the existing TZInfo 1.2.11 suite at seed 36231. Seed 99751 has the same pre-existing Zulu test-order failure on both unmodified release and patched release: a test mutates the cached TZInfo object's comparison method.
  • Ruby syntax and gem packaging checks pass. Targeted Lint passes on the combined branch with the existing, unrelated AssignmentInCondition warning excluded; no lint configuration was changed.

The current master's unreleased day-delta change was not brought into the consumer branch. No live scheduler or production operations were used. Linux/Windows and other Ruby runtimes were not run locally.

Breaking changes and limitations

No intended breaking API change. Local detection now retains the actual named timezone instead of a fallback with potentially different historical/DST rules. Explicit ENV['TZ'] and Rails Time.zone priority are unchanged. No operating-system files or settings were modified. No overlapping current fix was found.

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.

1 participant