Skip to content

Use /usr/bin/env bash for widely compatible shebang#674

Closed
SuperSandro2000 wants to merge 1 commit into
DeusData:mainfrom
SuperSandro2000:bin-bash
Closed

Use /usr/bin/env bash for widely compatible shebang#674
SuperSandro2000 wants to merge 1 commit into
DeusData:mainfrom
SuperSandro2000:bin-bash

Conversation

@SuperSandro2000

@SuperSandro2000 SuperSandro2000 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fix the shebangs of scripts to work on eg NixOS.

Checklist

  • Every commit is signed off (git commit -s) — required, CI rejects
    unsigned commits (DCO, see CONTRIBUTING.md)
  • Tests pass locally (make -f Makefile.cbm test)
  • Lint passes (make -f Makefile.cbm lint-ci)
  • New behavior is covered by a test (reproduce-first for bug fixes)

Signed-off-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
@DeusData

Copy link
Copy Markdown
Owner

Huge thanks for opening this PR and for the work you put into it.

The maintainer shop is currently full, so this may sit for a bit before it gets a proper review. We will come back to this as soon as possible with real feedback; I wanted to make sure it did not sit unacknowledged in the meantime.

@DeusData DeusData added bug Something isn't working priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens. labels Jun 29, 2026
@DeusData

DeusData commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Thanks. This looks like a focused portability change. Since it touches build scripts and generated hook scripts, please link the tracking issue or add a short rationale for the NixOS compatibility need, and we’ll need normal CI validation before merge. One security-hygiene nit: please change the fake ghp_... URL fixture to a deliberately non-token-looking placeholder so secret scanners don’t treat it like a leaked token shape.

@DeusData

DeusData commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Thanks for converging the remaining holdouts — we verified the repo already uses env-form on ~20 newer scripts, so this brings full consistency, and MSYS2 provides /usr/bin/env so the Windows legs are safe. Three small asks and this merges: (1) the two open questions from earlier (a rationale/tracking link, and the ghp_-shaped fixture string); (2) please keep at least one '#!/bin/bash' case in the parser tests — the current sweep removed the only coverage for absolute-path shebang extraction in infra_parse_shell; (3) FYI the hook-script hunks change runtime resolution on every user's machine (PATH-resolved bash instead of pinned /bin/bash) — standard practice and fine by us, just worth a sentence in the PR body. Thanks!


Update: to keep momentum on the bug backlog, we're going to carry the changes above over the line ourselves shortly — a distilled follow-up on current main implementing the notes in this thread, with you credited as Co-authored-by on the commit, and this PR closed referencing it. If you'd prefer to push the update yourself, just reply within the next couple of days and we'll gladly take yours instead. Thanks again for the contribution!

vvenegasv pushed a commit to vvenegasv/codebase-memory-mcp that referenced this pull request Jul 4, 2026
On NixOS (and other non-FHS systems) /bin/bash does not exist, so
scripts with an absolute shebang fail to run. Switch the remaining
holdouts to /usr/bin/env bash: eleven scripts/*.sh,
test-infrastructure/run.sh, and the three Claude Code hook scripts
emitted by src/cli/cli.c (gate, session reminder, subagent reminder).

Distilled from PR DeusData#674, with parser-test coverage preserved: the
infra_parse_shell* fixtures in tests/test_pipeline.c intentionally keep
#!/bin/bash so absolute-path shebang extraction stays covered, and
tests/repro fixtures are untouched.

Also replace the GitHub-PAT-shaped fixture string flagged in the DeusData#674
thread with an obviously fake placeholder (ghp_FAKE...) that still
matches the ghp_ + 36-alnum secret detector.

Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

DeusData commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Thanks for converging the shebang holdouts — NixOS users will appreciate it. We carried it over the line in 010ac9b (PR #812) with you credited as co-author, with two small deltas from the review: the absolute-path shebang parser fixtures keep one #!/bin/bash case (so that extraction path stays covered), and the ghp_-shaped fixture string became an obviously-fake placeholder that still trips the secret detector. A third hook heredoc had appeared since your branch (SubagentStart) — converted too, so the tree is now fully consistent at 0 raw /bin/bash shebangs outside fixtures. Closing in favor of the distill — thanks again!

@DeusData DeusData closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants