Skip to content

Commit 76c58aa

Browse files
committed
fix(smoke): compare persisted physical paths
1 parent 28341b5 commit 76c58aa

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/smoke/install-smoke.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ try {
249249
} else {
250250
Fail "PATH: empty process PATH produced unexpected contents"
251251
}
252+
$env:PATH = $OriginalProcessPath
252253

253254
# 7c. Test -SkipShell flag
254255
Write-Host ""

scripts/smoke/install-smoke.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,13 @@ fi
471471

472472
if run_unix_installer "$(command -v bash)" "$BASH_HOME" "$BASH_INSTALL" >/dev/null \
473473
&& run_unix_installer "$(command -v bash)" "$BASH_HOME" "$BASH_INSTALL" >/dev/null; then
474+
BASH_INSTALL_PHYSICAL=$(cd "$BASH_INSTALL" && pwd -P)
474475
bash_path=$(PATH="/usr/bin:/bin" HOME="$BASH_HOME" \
475476
bash --noprofile --rcfile "$BASH_RC" -i -c 'printf "%s" "$PATH"' 2>/dev/null)
476-
assert_path_once "bash" "$bash_path" "$BASH_INSTALL"
477+
assert_path_once "bash" "$bash_path" "$BASH_INSTALL_PHYSICAL"
477478
bash_empty_path=$(PATH="" HOME="$BASH_HOME" \
478479
/bin/bash --noprofile --rcfile "$BASH_RC" -i -c 'printf "%s" "$PATH"' 2>/dev/null)
479-
if [ "$bash_empty_path" = "$BASH_INSTALL" ]; then
480+
if [ "$bash_empty_path" = "$BASH_INSTALL_PHYSICAL" ]; then
480481
pass "bash: empty PATH does not introduce a current-directory entry"
481482
else
482483
fail "bash: empty PATH produced '$bash_empty_path'"
@@ -504,9 +505,10 @@ if command -v zsh >/dev/null 2>&1; then
504505
printf '# existing zsh config\n' > "$ZDOT_DIR/.zshrc"
505506
if ZDOTDIR="$ZDOT_DIR" run_unix_installer "$(command -v zsh)" "$ZSH_HOME" "$ZSH_INSTALL" >/dev/null \
506507
&& ZDOTDIR="$ZDOT_DIR" run_unix_installer "$(command -v zsh)" "$ZSH_HOME" "$ZSH_INSTALL" >/dev/null; then
508+
ZSH_INSTALL_PHYSICAL=$(cd "$ZSH_INSTALL" && pwd -P)
507509
zsh_path=$(PATH="/usr/bin:/bin" ZDOTDIR="$ZDOT_DIR" \
508510
zsh -f -c 'source "$ZDOTDIR/.zshrc"; print -rn -- "$PATH"')
509-
assert_path_once "zsh" "$zsh_path" "$ZSH_INSTALL"
511+
assert_path_once "zsh" "$zsh_path" "$ZSH_INSTALL_PHYSICAL"
510512
if [ ! -e "$ZSH_HOME/.zshrc" ]; then
511513
pass "zsh: ZDOTDIR is authoritative"
512514
else
@@ -528,9 +530,10 @@ if command -v fish >/dev/null 2>&1; then
528530
run_unix_installer "$(command -v fish)" "$FISH_HOME" "$FISH_INSTALL" >/dev/null \
529531
&& XDG_CONFIG_HOME="$FISH_HOME/.config" \
530532
run_unix_installer "$(command -v fish)" "$FISH_HOME" "$FISH_INSTALL" >/dev/null; then
533+
FISH_INSTALL_PHYSICAL=$(cd "$FISH_INSTALL" && pwd -P)
531534
fish_path=$(PATH="/usr/bin:/bin" fish --no-config -c \
532535
"source '$FISH_RC'; string join : -- \$PATH")
533-
assert_path_once "fish" "$fish_path" "$FISH_INSTALL"
536+
assert_path_once "fish" "$fish_path" "$FISH_INSTALL_PHYSICAL"
534537
else
535538
fail "fish: installer failed"
536539
fi
@@ -551,10 +554,11 @@ for mode in skip unknown; do
551554
fi
552555
manual_command=$(printf '%s\n' "$manual_out" | sed -n 's/^ \{0,4\}\(export PATH=.*\)$/\1/p' | head -1)
553556
if [ -n "$manual_command" ] && [ ! -e "$MANUAL_HOME/.netclaw/env" ]; then
557+
MANUAL_INSTALL_PHYSICAL=$(cd "$MANUAL_INSTALL" && pwd -P)
554558
manual_path=$(PATH="/usr/bin:/bin" bash -c "$manual_command; printf '%s' \"\$PATH\"")
555-
assert_path_once "$mode" "$manual_path" "$MANUAL_INSTALL"
559+
assert_path_once "$mode" "$manual_path" "$MANUAL_INSTALL_PHYSICAL"
556560
manual_empty_path=$(PATH="" /bin/bash -c "$manual_command; printf '%s' \"\$PATH\"")
557-
if [ "$manual_empty_path" = "$MANUAL_INSTALL" ]; then
561+
if [ "$manual_empty_path" = "$MANUAL_INSTALL_PHYSICAL" ]; then
558562
pass "$mode: manual command preserves an empty PATH without adding current directory"
559563
else
560564
fail "$mode: manual command produced '$manual_empty_path' from an empty PATH"

0 commit comments

Comments
 (0)