fix(install): don't clobber venv hermes entry point via symlink#24452
Closed
huangsen365 wants to merge 1 commit into
Closed
fix(install): don't clobber venv hermes entry point via symlink#24452huangsen365 wants to merge 1 commit into
huangsen365 wants to merge 1 commit into
Conversation
setup_path wrote the launcher with `cat > "$command_link_dir/hermes"`. If setup-hermes.sh had previously placed `ln -sf … venv/bin/hermes` at that path, the redirect followed the symlink and truncated the venv entry point. The shim's `exec "$HERMES_BIN" "$@"` then exec'd itself, so `hermes <anything>` hung forever in infinite recursion. `rm -f` the launcher path before writing so any pre-existing symlink is removed first. Adds a regression test covering both the source invariant and an end-to-end filesystem simulation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
This was referenced May 13, 2026
Contributor
|
Closing as already fixed on Triage notes (high confidence): If you still see this on the latest version, please reopen with reproduction steps. (Bulk-closed during a CLI triage sweep.) |
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.
What does this PR do?
scripts/install.sh::setup_pathwrites the user-facing launcher viacat > "$command_link_dir/hermes" <<EOF. If a priorsetup-hermes.shrunhad created that path as
ln -sf … venv/bin/hermes(which it does on line 335),the redirect follows the symlink and truncates the venv entry point itself.
The shim's
exec "$HERMES_BIN" "$@"then exec's the file it just rewrote → thehermescommand hangs forever in infinite recursion. Users hit this wheneverthey run
setup-hermes.shandscripts/install.shon the same machine.Fix:
rm -f "$command_link_dir/hermes"before thecat >, so any pre-existingsymlink is removed before the shim is written.
Related Issue
Type of Change
Changes Made
scripts/install.sh: addrm -f "$command_link_dir/hermes"before the launcher write insetup_path, with a comment explaining the symlink-clobber hazard.tests/test_install_sh_launcher_symlink_safe.py(new): two regression tests — a static check thatrm -fprecedes thecat >, plus an end-to-end filesystem simulation that creates the exact symlink layout and verifies the venv entry point is not truncated.How to Test
Reproduce the bug on
main:On this branch, the new test demonstrates the fix:
Both tests pass; running the snippet above with
rm -f "$command_link_dir/hermes"inserted leaves the sentinel intact.Checklist
Code
pytest tests/test_install_sh_launcher_symlink_safe.py tests/test_install_sh_pythonpath_sanitization.py -vand all tests passDocumentation & Housekeeping
rm -fand applies on every non-Windows install path🤖 Generated with Claude Code