Skip to content

[flutter_tools, devicelab] Fix filesystem safety guard for symlinked temp directories#187320

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
bkonyi:debug-fs-guard-symlink-fix
May 29, 2026
Merged

[flutter_tools, devicelab] Fix filesystem safety guard for symlinked temp directories#187320
auto-submit[bot] merged 1 commit into
flutter:masterfrom
bkonyi:debug-fs-guard-symlink-fix

Conversation

@bkonyi

@bkonyi bkonyi commented May 29, 2026

Copy link
Copy Markdown
Contributor

Resolve symbolic links of the system temporary directory before canonicalizing it in FSGuardIOOverrides.

On macOS, the system temp directory /var/folders/... is a symlink to /private/var/folders/.... Tests using createResolvedTempDirectorySync use the resolved path, causing the filesystem guard to mistakenly block modifications because they string-wise do not match the unresolved temp path.

Also:

  • Cache the resolved canonical temp path inside FSGuardIOOverrides to avoid costly I/O operations on every filesystem check.
  • Add a regression test in io_test.dart to verify symlinked temp directory support.
  • Use addTearDown in the new test for robust resource cleanup.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 29, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 29, 2026
@bkonyi
bkonyi requested a review from nshahan May 29, 2026 19:40

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates FSGuardIOOverrides in dev/devicelab/lib/framework/fs_safety.dart and packages/flutter_tools/test/src/fs_safety.dart to resolve symbolic links for the system temporary directory, and adds a test to verify this behavior. The reviewer suggests catching all types of objects instead of just Exception when resolving symbolic links, as UnimplementedError and UnsupportedError inherit from Error and would otherwise cause crashes in test environments using mock directories.

Comment thread dev/devicelab/lib/framework/fs_safety.dart
Comment thread packages/flutter_tools/test/src/fs_safety.dart
…temp directories

Resolve symbolic links of the system temporary directory before canonicalizing it in `FSGuardIOOverrides`.

On macOS, the system temp directory `/var/folders/...` is a symlink to `/private/var/folders/...`. Tests using `createResolvedTempDirectorySync` use the resolved path, causing the filesystem guard to mistakenly block modifications because they string-wise do not match the unresolved temp path.

Also:
* Cache the resolved canonical temp path inside `FSGuardIOOverrides` to avoid costly I/O operations on every filesystem check.
* Add a regression test in `io_test.dart` to verify symlinked temp directory support.
* Use `addTearDown` in the new test for robust resource cleanup.
@bkonyi
bkonyi force-pushed the debug-fs-guard-symlink-fix branch from 6ff77b8 to 5af1758 Compare May 29, 2026 19:43
@github-actions github-actions Bot removed the CICD Run CI/CD label May 29, 2026
@bkonyi bkonyi added the CICD Run CI/CD label May 29, 2026

@nshahan nshahan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick fix!

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue May 29, 2026
Merged via the queue into flutter:master with commit e7b755b May 29, 2026
173 of 174 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jun 1, 2026
flutter/flutter@b05a9d7...54e199a

2026-06-01 [email protected] Roll Fuchsia Linux SDK from jMR_VXQi07kAk8vbR... to q27k7_um1GvVrySZS... (flutter/flutter#187338)
2026-06-01 [email protected] Remove use of deprecated API related to removal of the VM isolate. (flutter/flutter#187013)
2026-06-01 [email protected] Improve `dependOnInheritedWidgetOfExactType` documentation to explain why it is bad to use it in initState (flutter/flutter#186216)
2026-06-01 [email protected] Revert "Move dart-lang/ai to a top level third party dependency in en… (flutter/flutter#187370)
2026-05-30 [email protected] Move dart-lang/ai to a top level third party dependency in engine (flutter/flutter#187268)
2026-05-30 [email protected] add sdf golden variants for OpenGL (flutter/flutter#187246)
2026-05-30 [email protected] Roll Skia from dc01525ac468 to 0aee4675e0ad (6 revisions) (flutter/flutter#187334)
2026-05-29 [email protected] Roll Skia from c480ba2eb2eb to dc01525ac468 (4 revisions) (flutter/flutter#187317)
2026-05-29 [email protected] Remove the Y coordinate flip workaround in the Material stretch effect shader now that it is no longer required by the Impeller GLES back end (flutter/flutter#187247)
2026-05-29 [email protected] [flutter_tools, devicelab] Fix filesystem safety guard for symlinked temp directories (flutter/flutter#187320)
2026-05-29 [email protected] Brings linux tests out of bringup. (flutter/flutter#187271)
2026-05-29 [email protected] Roll pub packages (flutter/flutter#187321)
2026-05-29 [email protected] Roll Fuchsia GN SDK from SEfYx3xgueX3aFAY3... to oOAcFhkoE2_-Sy67z... (flutter/flutter#187310)
2026-05-29 [email protected] Fix mismatch between hit-test tree and traversal tree (flutter/flutter#186826)
2026-05-29 [email protected] [Impeller] Ensure that the TextureGLES destructor cleans up all objects that it holds including the sync fence (flutter/flutter#187216)
2026-05-29 [email protected] Roll Packages from 10cbdc5 to e930ced (3 revisions) (flutter/flutter#187306)
2026-05-29 [email protected] Roll Skia from d9d6b440c4e7 to c480ba2eb2eb (1 revision) (flutter/flutter#187305)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11816)

flutter/flutter@b05a9d7...54e199a

2026-06-01 [email protected] Roll Fuchsia Linux SDK from jMR_VXQi07kAk8vbR... to q27k7_um1GvVrySZS... (flutter/flutter#187338)
2026-06-01 [email protected] Remove use of deprecated API related to removal of the VM isolate. (flutter/flutter#187013)
2026-06-01 [email protected] Improve `dependOnInheritedWidgetOfExactType` documentation to explain why it is bad to use it in initState (flutter/flutter#186216)
2026-06-01 [email protected] Revert "Move dart-lang/ai to a top level third party dependency in en… (flutter/flutter#187370)
2026-05-30 [email protected] Move dart-lang/ai to a top level third party dependency in engine (flutter/flutter#187268)
2026-05-30 [email protected] add sdf golden variants for OpenGL (flutter/flutter#187246)
2026-05-30 [email protected] Roll Skia from dc01525ac468 to 0aee4675e0ad (6 revisions) (flutter/flutter#187334)
2026-05-29 [email protected] Roll Skia from c480ba2eb2eb to dc01525ac468 (4 revisions) (flutter/flutter#187317)
2026-05-29 [email protected] Remove the Y coordinate flip workaround in the Material stretch effect shader now that it is no longer required by the Impeller GLES back end (flutter/flutter#187247)
2026-05-29 [email protected] [flutter_tools, devicelab] Fix filesystem safety guard for symlinked temp directories (flutter/flutter#187320)
2026-05-29 [email protected] Brings linux tests out of bringup. (flutter/flutter#187271)
2026-05-29 [email protected] Roll pub packages (flutter/flutter#187321)
2026-05-29 [email protected] Roll Fuchsia GN SDK from SEfYx3xgueX3aFAY3... to oOAcFhkoE2_-Sy67z... (flutter/flutter#187310)
2026-05-29 [email protected] Fix mismatch between hit-test tree and traversal tree (flutter/flutter#186826)
2026-05-29 [email protected] [Impeller] Ensure that the TextureGLES destructor cleans up all objects that it holds including the sync fence (flutter/flutter#187216)
2026-05-29 [email protected] Roll Packages from 10cbdc5 to e930ced (3 revisions) (flutter/flutter#187306)
2026-05-29 [email protected] Roll Skia from d9d6b440c4e7 to c480ba2eb2eb (1 revision) (flutter/flutter#187305)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…temp directories (flutter#187320)

Resolve symbolic links of the system temporary directory before
canonicalizing it in `FSGuardIOOverrides`.

On macOS, the system temp directory `/var/folders/...` is a symlink to
`/private/var/folders/...`. Tests using
`createResolvedTempDirectorySync` use the resolved path, causing the
filesystem guard to mistakenly block modifications because they
string-wise do not match the unresolved temp path.

Also:
* Cache the resolved canonical temp path inside `FSGuardIOOverrides` to
avoid costly I/O operations on every filesystem check.
* Add a regression test in `io_test.dart` to verify symlinked temp
directory support.
* Use `addTearDown` in the new test for robust resource cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants