fix(installer): rewrite staging path in venv files after mv to target#3
Merged
vladolaru merged 1 commit intoMay 13, 2026
Conversation
`install.sh.in` builds the venv at `${INSTALL_ROOT}/versions/.install-${INSTALL_TAG}-$$`
(STAGE_DIR), pip-installs the wheel into it, then `mv`s the directory
to `${TARGET_DIR}`. pip's wheel installer bakes the staging python path
into entry-point shebangs (e.g. `${STAGE_DIR}/bin/python`), so after the
`mv` every script under `bin/` has a shebang pointing at a path that no
longer exists. Result: the next `cc-codex-bridge` invocation fails with
bad interpreter: .../versions/.install-vX.Y.Z-NNNN/bin/python:
no such file or directory
The staging path is now rewritten to the final target path across the
venv files that embed it — `bin/*` shebangs, `pyvenv.cfg`, and the
`activate` scripts — using the venv's own `bin/python` (which is a
symlink chain to the system python and survives the `mv` intact). A
post-relocation `--help` smoke test guards against future regressions.
Verified against a real broken v1.5.1 install on disk: rewriting
`pip3.12 cc-codex-bridge pip3 activate.fish pip activate activate.csh
pyvenv.cfg` makes `cc-codex-bridge --version` succeed again.
Owner
|
@copilot resolve the merge conflicts in this pull request |
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
Problem
`install.sh.in` builds the venv at `${INSTALL_ROOT}/versions/.install-${INSTALL_TAG}-$$` (`STAGE_DIR`), pip-installs the wheel into it, then `mv`s the directory to `${TARGET_DIR}`. pip's wheel installer bakes the staging python path into entry-point shebangs (e.g. `${STAGE_DIR}/bin/python`). After the `mv`, every script in `bin/` has a shebang pointing at a path that no longer exists.
First invocation of `cc-codex-bridge` fails with:
```
bad interpreter: .../versions/.install-vX.Y.Z-NNNN/bin/python: no such file or directory
```
(Reproduced on a fresh `curl … | bash` install of v1.5.1 on macOS / Python 3.12 from Homebrew. The pre-`mv` `STAGE_DIR/bin/cc-codex-bridge --help` and `doctor` smoke tests pass because the staging path is still real at that point.)
Fix
After `mv`, rewrite the staging path to the final target path across the venv files that embed it:
The rewrite uses the venv's own `bin/python`, which is a symlink chain to the system python and survives the `mv` intact (the symlink target is absolute).
A new post-relocation `--help` smoke test catches any future regression at install time rather than on first invocation.
Test plan