fix(install): clear STUDIO_LOCAL_* env on POSIX normal install (#5146)

install.sh's normal-install branch passed the inherited parent-shell
environment to setup.sh without resetting STUDIO_LOCAL_INSTALL or
STUDIO_LOCAL_REPO. Consumers treat either as truthy:

  studio/setup.sh:491          checks STUDIO_LOCAL_INSTALL != "1"
  studio/install_python_stack.py:868  reads STUDIO_LOCAL_REPO, falsy
                                      if empty

Net effect: if a user or developer shell has stale STUDIO_LOCAL_*
exports from a previous --local run, a subsequent 'normal' install or
desktop-managed install silently takes the local-dev path: version
checks are skipped and an editable overlay points at the stale repo.

Fix mirrors install.ps1:1082-1087 on Windows: set STUDIO_LOCAL_INSTALL=0
and STUDIO_LOCAL_REPO= explicitly in the env prefix for the non-local
branch so setup.sh sees a clean state regardless of parent exports.

Co-authored-by: Daniel Han <unslothai@gmail.com>
This commit is contained in:
Daniel Han 2026-04-23 04:46:03 -07:00 committed by GitHub
commit 114908cd9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1587,8 +1587,15 @@ if [ "$STUDIO_LOCAL_INSTALL" = true ]; then
UNSLOTH_NO_TORCH="$SKIP_TORCH" \
bash "$SETUP_SH" </dev/null || _SETUP_EXIT=$?
else
# Explicitly reset STUDIO_LOCAL_INSTALL / STUDIO_LOCAL_REPO so a stale
# value inherited from the parent shell (e.g. a previous --local run in
# the same session) does not silently flip a normal install onto the
# local-dev path in setup.sh and install_python_stack.py. Mirrors the
# reset already done in install.ps1 for PowerShell.
SKIP_STUDIO_BASE="$_SKIP_BASE" \
STUDIO_PACKAGE_NAME="$PACKAGE_NAME" \
STUDIO_LOCAL_INSTALL=0 \
STUDIO_LOCAL_REPO= \
UNSLOTH_NO_TORCH="$SKIP_TORCH" \
bash "$SETUP_SH" </dev/null || _SETUP_EXIT=$?
fi