-
Notifications
You must be signed in to change notification settings - Fork 6k
[et] Simplify path canonicalisation logic #52275
[et] Simplify path canonicalisation logic #52275
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). 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. |
dec38dd
to
b77f183
Compare
bin/et
Outdated
*) | ||
echo "The host platform is not supported by this tool" | ||
exit 1 | ||
esac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more concise approach might be to check for realpath
and if it's on the path then just assume it's the tool we want regardless of platform, otherwise fall back on readlink -f
. Not sure which Linux distros (if any) bundle it though.
In order to canonicalise paths, previously we were doing an iterative computation to resolve symlinks to a canonical path, directory by directory. This was because on macOS and other BSDs, readlink doesn't support the `-f` (follow symlinks) option. However, macOS and other BSD-based systems *do* bundle the `realpath` utility, which resolves symlinks.
`readpath` is available on macOS, ubuntu, and debian by default. Otherwise, fall back to realink -f (the `-f` option is only available in the GNU implementation).
584f98c
to
86e83c6
Compare
…147104) flutter/engine@f22fb59...4d34b6d 2024-04-20 [email protected] [et] Simplify path canonicalisation logic (flutter/engine#52275) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
…lutter#147104) flutter/engine@f22fb59...4d34b6d 2024-04-20 [email protected] [et] Simplify path canonicalisation logic (flutter/engine#52275) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
# | ||
# The function is enclosed in a subshell to avoid changing the working directory | ||
# of the caller. | ||
function follow_links() ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is copy-pasted all over the engine repo. If this change is a better way to do things, should we change all occurrences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting -- I'll set a reminder for a week and if no one's raised any issues, it seems like a cleanup worth doing.
In order to canonicalise paths, previously we were doing an iterative computation to resolve symlinks to a canonical path, directory by directory. This was because on macOS and other BSDs, readlink doesn't support the
-f
(follow symlinks) option. However, macOS and other BSD-based systems do bundle therealpath
utility, which resolves symlinks.This patch is stacked on top of #52274 and is the second commit (dec38dd).
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.