fix(venv_shebang_rewriter): avoid depending on host coreutils - #4125
Open
nicdumz wants to merge 2 commits into
Open
fix(venv_shebang_rewriter): avoid depending on host coreutils#4125nicdumz wants to merge 2 commits into
nicdumz wants to merge 2 commits into
Conversation
nicdumz
force-pushed
the
nixos-coreutils-fix
branch
from
August 29, 2026 14:24
a31d314 to
bc2e057
Compare
nicdumz
marked this pull request as ready for review
August 29, 2026 14:25
nicdumz
marked this pull request as draft
August 29, 2026 14:27
nicdumz
force-pushed
the
nixos-coreutils-fix
branch
2 times, most recently
from
August 29, 2026 14:38
52a7184 to
e0e8047
Compare
…ils script venv_shebang_rewriter.sh ran directly (ctx.actions.run) with no declared PATH, and used head/tail/chmod resolved from PATH. On systems without an FHS-style /bin:/usr/bin (e.g. NixOS), this failed with 'head: command not found'. Port it to a plain Python script and expose it as a py_binary, matching this project's own documented guidance (PyExecToolsInfo's exec_interpreter docs: 'prefer to define a py_binary instead ... this makes it much easier to setup the runtime environment'). This needs no new external dependency: the interpreter comes from this project's own Python toolchain, already used everywhere else in this repo.
wheel_record_rewriter.sh ran directly (ctx.actions.run) with no declared PATH, and used awk resolved from PATH. On systems without an FHS-style /bin:/usr/bin (e.g. NixOS), this failed with 'awk: command not found'. Rather than translate the awk program into POSIX sh, port it to a plain Python script and expose it as a py_binary, same rationale and approach as venv_shebang_rewriter.py.
nicdumz
force-pushed
the
nixos-coreutils-fix
branch
from
August 29, 2026 14:48
e0e8047 to
8994e23
Compare
nicdumz
marked this pull request as ready for review
August 29, 2026 14:58
Collaborator
|
I'm a bit confused how this is working -- I would expect there to be a bootstrapping issue (a py_binary is being required to build a py_binary) If Nix doesn't have /usr:/usr/bin on path, what does it have? How is one supposed to invoke coreutils if not by relying on path? |
Author
|
Hey Richard,
Note that A upside of this PR: perhaps as a follow-up both rewriters can move to Python only instead of having to fork between windows vs other execution platforms? Notes:
HTH |
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.
Two scripts used as build actions in the pip integration ran directly (
ctx.actions.run, no shell) with no declaredPATH. On sandboxed environments without an FHS-style/bin:/usr/bin(e.g. NixOS), these fail with<tool>: command not found, even though the action's own executable resolves fine.venv_shebang_rewriter.shresolvedhead/tail/chmodfromPATH.wheel_record_rewriter.shresolvedawkfromPATH.Fix
Both are ported to plain Python scripts exposed as
py_binarytargets, per this project's own documented guidance (PyExecToolsInfo'sexec_interpreterdocs recommend apy_binary+cfg=execover manual interpreter wiring). This sidesteps hostPATHconcerns entirely.