Skip to content

Replace readdir_r call in TimeZoneInfo.Unix #116119

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

Merged
merged 4 commits into from
May 30, 2025

Conversation

jozkee
Copy link
Member

@jozkee jozkee commented May 29, 2025

Found this while investigating something else. It's possible System.IO was not initially used because the assembly was just folded into System.PrivateCoreLib (#53231) when the change to TimeZoneInfo was made 46d9b31.

@jozkee jozkee requested review from stephentoub, adamsitnik, mdh1418, a team and Copilot May 29, 2025 22:46
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 29, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the legacy readdir_r code with the newer FileSystemEnumerable API for enumerating time zone files in Unix, while also cleaning up some static field names and unused variables in the test suite.

  • Renames a static byte array field in TimeZoneInfoTests.cs to follow static naming conventions.
  • Removes an unused local variable in TimeZoneInfoTests.Common.cs.
  • Replaces a custom recursive directory enumeration with FileSystemEnumerable in TimeZoneInfo.Unix.NonAndroid.cs.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.cs Renamed static field and updated test usages accordingly.
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/TimeZoneInfoTests.Common.cs Removed an unused local variable.
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.NonAndroid.cs Replaced readdir_r-based enumeration with FileSystemEnumerable; review the return logic in FindTimeZoneId.

@jozkee jozkee added area-System.DateTime and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 29, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-datetime
See info in area-owners.md if you want to be subscribed.

@tarekgh
Copy link
Member

tarekgh commented May 29, 2025

/azp run runtime-androidemulator

@tarekgh
Copy link
Member

tarekgh commented May 29, 2025

/azp run runtime-ioslike,runtime-ioslikesimulator,runtime-maccatalyst

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@tarekgh tarekgh added this to the 10.0.0 milestone May 29, 2025
Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Left small change request in the test. Also, ensure the added test is passing in all platforms including mobile and browser platforms. I enabled the mobile legs.

@jozkee jozkee changed the title Replace readdir_r call with FileSystemEnumerable in TimeZoneInfo.Unix Replace readdir_r call in TimeZoneInfo.Unix May 30, 2025
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice cleanup @jozkee ! LGTM

@jozkee
Copy link
Member Author

jozkee commented May 30, 2025

/ba-g I have no idea how to proceed with the error on HostActivation.Tests (there's no console log), but its clearly unrelated.

@jozkee jozkee merged commit 1713d65 into dotnet:main May 30, 2025
138 of 144 checks passed
@jozkee jozkee deleted the timezoneinfo_readdir_r branch May 30, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants