Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix literal PATH matching during uninstall
  • Loading branch information
homeyong committed Aug 13, 2026
commit 0829e0a7b91940e80c0ba03381de92403faf50fd
6 changes: 4 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ profile_has_block() {
profile=$1
>
[ -f "$profile" ] && [ ! -L "$profile" ] || return 1
awk -v '
ETHERSCAN_PROFILE_TARGET=$target awk '
BEGIN { }
previous == "# Etherscan CLI" && $0 == target { found = 1; exit }
{ previous = $0 }
END { exit found ? 0 : 1 }
Expand All @@ -93,7 +94,8 @@ remove_profile_block() {
rm -f "$tmp"
die "could not preserve permissions for $profile"
fi
if ! awk -v '
if ! ETHERSCAN_PROFILE_TARGET=$target awk '
BEGIN { }
{
if (pending) {
if ($0 == target) { pending = 0; next }
Expand Down
11 changes: 11 additions & 0 deletions scripts/test-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ HOME="$manual_home" XDG_CONFIG_HOME="$config_home" sh "$installer" --install-dir
grep -Fx "$manual_line" "$manual_home/.profile" >/dev/null || { printf 'uninstall removed a hand-written PATH line\n' >&2; exit 1; }
[ -d "$manual_dir" ] || { printf 'uninstall removed an unprovenanced directory\n' >&2; exit 1; }

# Installer-owned profile entries round-trip paths containing a literal backslash.
backslash_home="$temp_dir/backslash-home"
backslash_config_home="$temp_dir/backslash-config-home"
backslash_dir="$temp_dir/back\\slash dir"
mkdir -p "$backslash_home" "$backslash_config_home/etherscan"
HOME="$backslash_home" SHELL=/bin/sh sh "$installer" --version "$version" --install-dir "$backslash_dir" >/dev/null
grep -Fx '# Etherscan CLI' "$backslash_home/.profile" >/dev/null || { printf 'backslash-path install did not add its profile marker\n' >&2; exit 1; }
HOME="$backslash_home" XDG_CONFIG_HOME="$backslash_config_home" sh "$installer" --install-dir "$backslash_dir" --uninstall >/dev/null
[ ! -e "$backslash_dir" ] || { printf 'backslash-path uninstall left its directory\n' >&2; exit 1; }
grep -Fx '# Etherscan CLI' "$backslash_home/.profile" >/dev/null && { printf 'backslash-path uninstall left its profile block behind\n' >&2; exit 1; }

# A shared directory retains unrelated files, PATH, and provenance.
shared_dir="$temp_dir/shared dir"
HOME="$uninstall_home" SHELL=/bin/sh sh "$installer" --version "$version" --install-dir "$shared_dir" >/dev/null
Expand Down