fix(installer): set UV_NO_CONFIG=1 to avoid permission denied under sudo -u

When the installer is run via , uv resolves config file
paths against the process owner's (root) home directory rather than the
effective user's, causing a Permission denied error when trying to read
/root/uv.toml.

Setting UV_NO_CONFIG=1 prevents uv from discovering any config files
(uv.toml, pyproject.toml) during installation, which is the correct
behavior for a bootstrap script that manages its own environment.

Fixes #21269
This commit is contained in:
hllqkb 2026-05-07 21:30:52 +08:00 committed by Teknium
parent 292f468366
commit c80fa728bd
2 changed files with 8 additions and 0 deletions

View file

@ -28,6 +28,10 @@ if [ -n "${PYTHONHOME:-}" ]; then
unset PYTHONHOME unset PYTHONHOME
fi fi
# Prevent uv from discovering config files (uv.toml, pyproject.toml) from the
# wrong user's home directory when running under sudo -u <user>. See #21269.
export UV_NO_CONFIG=1
# Colors # Colors
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[0;32m' GREEN='\033[0;32m'

View file

@ -29,6 +29,10 @@ NC='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"
# Prevent uv from discovering config files (uv.toml, pyproject.toml) from the
# wrong user's home directory when running under sudo -u <user>. See #21269.
export UV_NO_CONFIG=1
PYTHON_VERSION="3.11" PYTHON_VERSION="3.11"
is_termux() { is_termux() {