fix(scripts): use /usr/bin/env bash shebangs (NixOS has no /bin/bash)

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 #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 #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>
This commit is contained in:
Martin VogelandSandro Jäckel committed 2026-07-03 20:11:49 +02:00
1 parent 7b93210ca2
commit 50392a4188
14 files changed
+16 -16

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# benchmark-search-graph.sh — Time search_graph name_pattern= queries against a
# codebase-memory-mcp binary to measure the regex / LIKE pre-filter performance.
#
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# build.sh — Clean build of production binary (standard or with UI).
#
# Usage:
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Verify NOLINT(misc-no-recursion) only appears on whitelisted functions.
WHITELIST="src/foundation/recursion_whitelist.h"
if [ ! -f "$WHITELIST" ]; then
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# clean.sh — Remove ALL build artifacts, caches, and generated files.
#
# Usage: scripts/clean.sh
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# embed-frontend.sh — Convert built frontend assets into linkable object files.
#
# Usage: scripts/embed-frontend.sh <dist_dir> <output_dir>
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# env.sh — Shared environment detection for all build scripts.
#
# Sourced by test.sh, build.sh, lint.sh. Not meant to run standalone.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# lint.sh — Run all linters (clang-tidy + cppcheck + clang-format).
#
# Usage:
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# repro.sh — Build + run the cumulative BUG-REPRODUCTION suite (test-repro).
#
# Unlike test.sh (the gating suite, must be GREEN), this suite is RED by design:
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# soak-test.sh — Endurance test for codebase-memory-mcp.
#
# Runs compressed workload cycles: queries, file mutations, reindexes, idle periods.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# test.sh — Clean build + run all C tests with ASan + UBSan.
#
# Usage:
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# vendor-grammar.sh: Vendor a single tree-sitter grammar into internal/cbm/vendored/grammars/<name>/
# Usage: ./scripts/vendor-grammar.sh <repo_url> <name> [subdir]
# repo_url: GitHub repository URL (e.g., https://github.com/tree-sitter/tree-sitter-json)
+3 -3
View File
@@ -2055,7 +2055,7 @@ void cbm_install_hook_gate_script(const char *home, const char *binary_path) {
return;
}
(void)fprintf(f,
"#!/bin/bash\n"
"#!/usr/bin/env bash\n"
"# codebase-memory-mcp search augmenter (Claude Code PreToolUse).\n"
"# NOTE: the legacy filename is kept for zero-migration upgrades.\n"
"# Despite the name this NEVER blocks a tool call - it only adds\n"
@@ -2099,7 +2099,7 @@ static void cbm_install_session_reminder_script(const char *home) {
return;
}
(void)fprintf(
f, "#!/bin/bash\n"
f, "#!/usr/bin/env bash\n"
"# SessionStart hook: remind agent to use codebase-memory-mcp tools.\n"
"# Installed by codebase-memory-mcp. Fires on startup/resume/clear/compact.\n"
"cat << 'REMINDER'\n"
@@ -2187,7 +2187,7 @@ static void cbm_install_subagent_reminder_script(const char *home) {
* backslashes, or newlines, so the JSON below is valid as written — no
* runtime escaping (and no python3/jq dependency) is required. */
(void)fprintf(f,
"#!/bin/bash\n"
"#!/usr/bin/env bash\n"
"# SubagentStart hook: tell subagents to use codebase-memory-mcp tools.\n"
"# Installed by codebase-memory-mcp. Fires when any subagent is spawned.\n"
"# SubagentStart injects context via JSON additionalContext, not plain stdout.\n"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Local CI — test all platforms before pushing.
#
# Coverage:
+1 -1
View File
@@ -4669,7 +4669,7 @@ TEST(envscan_secret_value_exclusion) {
write_temp_file(
tmpdir, "deploy.sh",
"#!/bin/bash\n"
"export GH_URL=\"https://ghp_abcdefghijklmnopqrstuvwxyz1234567890@github.com/repo\"\n"
"export GH_URL=\"https://ghp_FAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKEFAKE@github.com/repo\"\n"
"export NORMAL_ENDPOINT=\"https://api.example.com/orders\"\n");
cbm_env_binding_t bindings[32];