Load Location.local by symlink name#16002
Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom Jul 21, 2025
Merged
Load Location.local by symlink name#16002straight-shoota merged 1 commit intocrystal-lang:masterfrom
Location.local by symlink name#16002straight-shoota merged 1 commit intocrystal-lang:masterfrom
Conversation
Location.local from symlink nameLocation.local by symlink name
ysbaddaden
approved these changes
Jul 19, 2025
This was referenced Jul 22, 2025
Merged
straight-shoota
added a commit
that referenced
this pull request
Jul 23, 2025
…16022) Fixes a regression caused by simultaneous changes to the same code in #16004 and #16002 (#16004 (comment)). The call was never supposed to go to `File.readlink` (i.e. `Crystal::System::File.readlink`) but the public method `::File.readlink`. Now with `::File.readlink?` available from #16004, we can use that directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
Time::Location.localon Unix systems would always have a generic name,Local(orUTCif/etc/localtimeis missing) because the zoneinfo described in/etc/localtimedoes not have an obvious name attached./etc/localtimeis typically a symlink into the zoneinfo database. With this change, we read the symlink and defer the name of the location from the path inside the zoneinfo root directory. We do not actually parse the target file and instead load the location by name.Originally suggested in https://forum.crystal-lang.org/t/how-do-you-get-the-location-name-of-the-local-timezone/8191/3?u=straight-shoota, with alterations from #15959 (comment) (same as jiff).
Supersedes #15959. I think this is the better solution because with #15959 we could end up with two location instances with the same name but potentially different rules.