Skip to content

[fuchsia] Export ICU_TIMEZONE_FILES_DIR only when tzdata directory is valid - #194242

Draft
zijiehe-google-com wants to merge 2 commits into
flutter:masterfrom
zijiehe-google-com:fuchsia-tzdata-env
Draft

zijiehe-google-com wants to merge 2 commits into
flutter:masterfrom
zijiehe-google-com:fuchsia-tzdata-env

Conversation

@zijiehe-google-com

@zijiehe-google-com zijiehe-google-com commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

In flutter_runner, InitializeTZData() previously set ICU_TIMEZONE_FILES_DIR via setenv(..., 0) before attempting openat().

When openat() failed (e.g. running in test environments or systems without timezone files), InitializeTZData() logged an error and returned false, but left ICU_TIMEZONE_FILES_DIR pointing to a non-existent path in the environment. This prematurely polluted the process environment and prevented downstream initializers (such as Dart VM's InitializeTZData(), which also calls setenv(..., 0)) from setting a valid path.

This change:

  1. Checks getenv(kICUTZEnv) first to preserve the ability of unit tests (e.g. RunnerTZDataTest.LoadsWithTZDataPresent) to override the directory.
  2. Only exports ICU_TIMEZONE_FILES_DIR via setenv() after openat() succeeds, matching the pattern in Dart VM's runtime/vm/os_fuchsia.cc.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-fuchsia Fuchsia code specifically labels Oct 12, 2026
…cu/44/le

Updates kICUTZDataDir from /config/data/tzdata/icu/44/le to /config/tzdata/icu/44/le
to match the tzdata-icu directory capability mounted in common.shard.cml and
the Dart VM's Fuchsia OS layer.
… valid

Previously, InitializeTZData() called setenv(ICU_TIMEZONE_FILES_DIR, ..., 0)
before checking openat(), leaving an invalid path in the process environment
when tzdata could not be opened.

Check getenv() first to preserve the ability of tests to override the
timezone directory, and only call setenv() after openat() succeeds.
@Hzj-jie
Hzj-jie force-pushed the fuchsia-tzdata-env branch from 9e7dbc9 to 7e45c44 Compare October 12, 2026 19:48
@zijiehe-google-com zijiehe-google-com changed the title Fuchsia tzdata env [fuchsia] Export ICU_TIMEZONE_FILES_DIR only when tzdata directory is valid Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-fuchsia Fuchsia code specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant