Skip to content

fix: remove --break-system-packages silent fallback in install.sh#19

Open
xiaolai wants to merge 1 commit into
AgriciDaniel:mainfrom
xiaolai:fix/nlpm-pip-break-system-packages
Open

fix: remove --break-system-packages silent fallback in install.sh#19
xiaolai wants to merge 1 commit into
AgriciDaniel:mainfrom
xiaolai:fix/nlpm-pip-break-system-packages

Conversation

@xiaolai

@xiaolai xiaolai commented Apr 20, 2026

Copy link
Copy Markdown

Automated audit: This PR was generated by NLPM, a natural language programming linter, running via claude-code-action. Please evaluate the diff on its merits.

Bug

install.sh lines 70–76 silently fall back to pip install --break-system-packages when the standard pip install fails. This flag bypasses pip's protection for system-managed Python environments, which can corrupt system packages without the user's knowledge or consent.

On modern Linux distros (Debian 12+, Ubuntu 23.04+, Fedora 38+), system Python is externally managed. The --break-system-packages flag exists for explicit opt-in, not as a transparent fallback.

Fix

Replace the silent fallback with a clear failure message and virtual environment guidance, consistent with the script's existing error-surfacing pattern (e.g. the pip not found branch on line 78 already does this correctly).

Before

${PIP_CMD} install -q -r "${SKILL_DIR}/requirements.txt" 2>/dev/null \
    || { echo "  ⚠ Standard pip install failed, trying --break-system-packages..." >&2; \
         ${PIP_CMD} install --break-system-packages -q -r "${SKILL_DIR}/requirements.txt" 2>/dev/null; } \
    && echo "  ✓ Python dependencies installed" \
    || echo "  ⚠ pip install failed. ..."

After

if ${PIP_CMD} install -q -r "${SKILL_DIR}/requirements.txt" 2>/dev/null; then
    echo "  ✓ Python dependencies installed"
else
    echo "  ⚠ pip install failed. To install in a virtual environment:" >&2
    echo "    python3 -m venv ~/.venv && source ~/.venv/bin/activate" >&2
    echo "    pip install -r ${SKILL_DIR}/requirements.txt" >&2
    echo "  Or install globally (use with care): pip3 install -r ${SKILL_DIR}/requirements.txt" >&2
fi

Users who need the global install can still do it explicitly — the failure message tells them how.

Silent fallback to --break-system-packages can corrupt system Python
packages without explicit user consent. Replace with a clear failure
message and virtual environment guidance.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants