Skip to content

Correctly handle failure to read /proc/self/exe link#184700

Merged
robert-ancell merged 2 commits into
flutter:masterfrom
robert-ancell:linux-get-executable-directory-handle-readlink-error
Apr 8, 2026
Merged

Correctly handle failure to read /proc/self/exe link#184700
robert-ancell merged 2 commits into
flutter:masterfrom
robert-ancell:linux-get-executable-directory-handle-readlink-error

Conversation

@robert-ancell
Copy link
Copy Markdown
Contributor

Existing code would attempt to use the negative length to create a std::string.

Existing code was also returning an empty path when the length was > PATH_MAX. This was removed to match the code in engine/src/flutter/fml/platform/linux/paths_linux.cc

Existing code would attempt to use the negative length to create a std::string.

Existing code was also returning an empty path when the length was > PATH_MAX.
This was removed to match the code in engine/src/flutter/fml/platform/linux/paths_linux.cc
@flutter-dashboard
Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Apr 7, 2026
@robert-ancell
Copy link
Copy Markdown
Contributor Author

Second part of #184476

@robert-ancell robert-ancell added the CICD Run CI/CD label Apr 7, 2026
Copy link
Copy Markdown
Contributor

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

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 modifies the Linux implementation of GetExecutableDirectory by reducing the buffer size and changing the error handling for readlink. Feedback suggests that these changes reduce robustness against path truncation; it is recommended to use a larger buffer and explicitly check for both errors and truncation to ensure the returned path is complete.

Comment thread engine/src/flutter/shell/platform/common/path_utils.cc
Copy link
Copy Markdown
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 8, 2026
@robert-ancell robert-ancell enabled auto-merge April 8, 2026 01:48
@robert-ancell robert-ancell added the CICD Run CI/CD label Apr 8, 2026
@robert-ancell robert-ancell added this pull request to the merge queue Apr 8, 2026
Merged via the queue into flutter:master with commit 6850227 Apr 8, 2026
176 of 177 checks passed
@robert-ancell robert-ancell deleted the linux-get-executable-directory-handle-readlink-error branch April 8, 2026 21:54
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 9, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 9, 2026
flutter/flutter@05e0ae0...81c87ea

2026-04-09 katelovett@google.com Remove last material dependency from cupertino tests (flutter/flutter#184781)
2026-04-09 engine-flutter-autoroll@skia.org Roll Skia from 7c46cb639dba to 4d0f5389e131 (7 revisions) (flutter/flutter#184812)
2026-04-09 goderbauer@google.com Make `windowing_test` follow repo analyzer rules (flutter/flutter#184752)
2026-04-09 116356835+AbdeMohlbi@users.noreply.github.com Improve documentation of `frictionFactor` function (flutter/flutter#184509)
2026-04-09 engine-flutter-autoroll@skia.org Roll Skia from d2b0bd12576a to 7c46cb639dba (1 revision) (flutter/flutter#184796)
2026-04-09 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from JLBh4Z9PKsjIJcqDU... to SEfYx3xgueX3aFAY3... (flutter/flutter#184797)
2026-04-09 katelovett@google.com Fixed freeze flow (flutter/flutter#184793)
2026-04-09 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#184795)
2026-04-09 engine-flutter-autoroll@skia.org Roll Skia from e9ed4fc9f154 to d2b0bd12576a (36 revisions) (flutter/flutter#184791)
2026-04-08 43054281+camsim99@users.noreply.github.com [Android] Allow sensitive content to gracefully fail when unregistering host before registering (flutter/flutter#184789)
2026-04-08 34465683+rkishan516@users.noreply.github.com Refactor: remove material from autocomplete_test, scrollable_restoration_test, semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test (flutter/flutter#184615)
2026-04-08 jmccandless@google.com Warn about the use of TestSemantics (flutter/flutter#184369)
2026-04-08 katelovett@google.com Change freeze flow to pull_request_target (flutter/flutter#184785)
2026-04-08 1063596+reidbaker@users.noreply.github.com Update to the beta dart version for 3.44 branch cut.  (flutter/flutter#184770)
2026-04-08 737941+loic-sharma@users.noreply.github.com [Dot shorthands] Migrate examples/api/test (flutter/flutter#183966)
2026-04-08 rmacnak@google.com [fuchsia] Give AOT runners the ability to copy FFI callback thunks. (flutter/flutter#184696)
2026-04-08 victorsanniay@gmail.com Add await or ignore lint to invokeMethod callsites (flutter/flutter#182870)
2026-04-08 robert.ancell@canonical.com Correctly handle failure to read /proc/self/exe link (flutter/flutter#184700)
2026-04-08 engine-flutter-autoroll@skia.org Roll Skia from e264d870a380 to e9ed4fc9f154 (11 revisions) (flutter/flutter#184713)
2026-04-08 engine-flutter-autoroll@skia.org Roll Packages from 5299279 to 0e0a032 (5 revisions) (flutter/flutter#184720)
2026-04-08 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#184772)
2026-04-08 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 1rcChbOv4nSTVkUxs... to pDXMXRIjEHTw7B0sk... (flutter/flutter#184722)
2026-04-08 73785960+xfce0@users.noreply.github.com Remove navigator_utils cross-imports from cupertino tests (flutter/flutter#184282)
2026-04-08 victorsanniay@gmail.com Even more awaits v2 (flutter/flutter#184552)
2026-04-08 15619084+vashworth@users.noreply.github.com Allow personal skills to be gitignored (flutter/flutter#184727)
2026-04-08 dacoharkes@google.com [ci] mac_arm64 build_test re-enable shard 1 presubmit (flutter/flutter#184751)
2026-04-08 katelovett@google.com Fix repo check on code freeze (flutter/flutter#184771)

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 bmparr@google.com,stuartmorgan@google.com 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
mbcorona pushed a commit to mbcorona/flutter that referenced this pull request Apr 15, 2026
Existing code would attempt to use the negative length to create a
std::string.

Existing code was also returning an empty path when the length was >
PATH_MAX. This was removed to match the code in
engine/src/flutter/fml/platform/linux/paths_linux.cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants