fix(install): stop update_shell_rc from duplicating its PATH block forever - #943
Merged
agentforce314 merged 1 commit intoSep 19, 2026
Conversation
…rever The dedup check compared the shell-EXPANDED real home directory (grep -qF "$HOME/.local/bin" "$rc", double-quoted so bash expands $HOME before grep sees it) against the line the function itself writes from a SINGLE-quoted variable, which lands in the rc file as the literal, unexpanded text "$HOME/.local/bin" -- a literal dollar sign, never the real path. The check could therefore never match the installer's own prior write, so every re-run (reinstall, --local, update) appended another duplicate marker+PATH block, unbounded, forever. Now checks for RC_MARKER (the literal line we actually write) plus the other real spellings ~/.local/bin can take in a pre-existing rc file (literal '$HOME/.local/bin', '~/.local/bin', and the fully-expanded real path), so a genuinely pre-existing PATH entry is still recognized and skipped, matching the original intent -- only the installer's own never-matching re-run case is fixed.
Test Results 5 files 1 018 suites 28m 1s ⏱️ For more details on these failures, see this check. Results for commit d312a25. |
Owner
|
LGTM. Thank you! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
update_shell_rc()'s dedup check is a real, deterministic bug that affects every user who runsinstall.shmore than once (reinstall,--local,update, etc.).The check compares the shell-expanded real home directory:
against the line the function itself appends, which comes from a single-quoted variable:
That line lands in the rc file as the literal, unexpanded text
$HOME/.local/bin— a literal dollar sign, never the real path. The dedup check can therefore never match the installer's own prior write, and every re-run appends another duplicateRC_MARKER+ PATH block, unbounded, forever.Concretely reproduced this against a real
.zshrcaccumulating 8 duplicate blocks from repeated installs over the course of normal use.Fix
Check for
RC_MARKER(the literal marker line we actually write, guaranteed present on any rc we've already patched) plus the other real spellings~/.local/bincan take in a pre-existing rc file: literal$HOME/.local/bin,~/.local/bin, and the fully-expanded real path. This fixes the never-matching re-run case while preserving the original intent — a genuinely pre-existing PATH entry (in any of these forms) is still recognized and skipped.Tests
New
tests/test_install_sh_rc_dedup.py— extractsupdate_shell_rc()verbatim out ofinstall.shviased(so it always exercises the real current source, not a hand-copied approximation) and exercises it against a fake$HOME:~/.local/bin(tilde form) is recognized and not re-patchedNo install.sh tests existed in the repo before this.
Test plan
python3 -m pytest tests/test_install_sh_rc_dedup.py -v— 5/5 pass against the fixbash -n install.sh— syntax OK🤖 Generated with Claude Code