From 59f5b1a53728842beaf3b2b6f073980564d39c01 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 19 Apr 2024 14:57:46 -0700 Subject: [PATCH] [et] Fix path canonicalization Previously we were getting the enclosing directory path of the `et` tool (via the `dirname` builtin), then canonicalising the path by resolving symlinks. This doesn't work if the `et` on the path is itself a symlink. For example, if a user created a symlink `et` in a concrete directory at `~/.local/bin`: ``` ~/.local/bin/et -> ~/src/flutter/engines/src/flutter/bin/et ``` first we'd compute the dirname of the script: ``` ~/.local/bin ``` then we'd resolve symlinks: ``` ~/.local/bin ``` and incorrectly assume that was the engine directory. Instead, we now resolve symlinks, then compute the enclosing directory. --- bin/et | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/et b/bin/et index a3c30df0241d9..f5389c1af7445 100755 --- a/bin/et +++ b/bin/et @@ -27,7 +27,7 @@ function follow_links() ( echo "$file" ) -SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") +SCRIPT_DIR="$(dirname -- "$(follow_links "${BASH_SOURCE[0]}")")" ENGINE_DIR="$(cd "$SCRIPT_DIR/.."; pwd -P)" case "$(uname -s)" in