From 1b8bd659861ecc02e9b3d9fe217fda47376f6599 Mon Sep 17 00:00:00 2001 From: Riccardo Schirone <562321+ret2libc@users.noreply.github.com> Date: Mon, 18 May 2026 15:53:06 +0200 Subject: [PATCH] fix(scripts): make install_uv resilient to missing env helper (#547) The uv installer does not always create $HOME/.local/bin/env (older versions, or when the install is skipped), so the unconditional `source` broke setup with `No such file or directory`. Source the helper only if it exists, prepend $HOME/.local/bin to PATH as a fallback, and fail loudly if `uv` is still unreachable after install. Co-authored-by: Claude Opus 4.7 (1M context) --- scripts/common.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index cb02ff08..09dc7ad2 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -92,8 +92,22 @@ install_uv() { print_status "Installing uv..." if ! command_exists uv; then curl -fsSL https://astral.sh/uv/install.sh | sh - print_status "Sourcing uv environment..." - source "$HOME/.local/bin/env" + print_status "Loading uv into PATH..." + # Newer uv installers drop a helper at $HOME/.local/bin/env; older + # ones do not. Source it when present and always ensure the install + # dir is on PATH so the freshly-installed binary is reachable. + if [ -f "$HOME/.local/bin/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.local/bin/env" + fi + case ":$PATH:" in + *":$HOME/.local/bin:"*) ;; + *) export PATH="$HOME/.local/bin:$PATH" ;; + esac + if ! command_exists uv; then + print_error "uv install completed but 'uv' is not on PATH" + return 1 + fi print_success "uv installed successfully" else print_success "uv is already installed"