tests: a path-named or launcher-exec'd command that does not exist (rc 127) still fails open in a suite fragment

Open
#2,303 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bash
Domain
testing

Research direction

Start in tests/run_all_tests.sh, where command_not_found_handle is defined and where fragments are sourced, including the . f || exit 1 line that suppresses ERR inside a fragment. Reproduce with the plant "$TESTS_DIR/does_not_exist_plant.sh" added to tests/sections/1a7-sandbox-source-budgets.sh, run via EIGS_SUITE_SECTIONS='1a7' bash run_all_tests.sh. Done when a path-named or launcher-exec'd missing command (rc 126/127) prints a FAIL naming the section and path and the run exits nonzero, with a selftest that goes green when the check is removed.

Written by the indexing model from the issue text.

Description

area:gates kind:gate-defect

Follow-up to the hq#58 [1a7] fix (InauguralSystems/hq#58, PR claude/ci58-es-2a-fragments).

That PR makes tests/run_all_tests.sh define command_not_found_handle, so a bare name that does not exist (run_test ...) fails its section. bash calls that hook only for PATH lookups. A path-named command that does not exist never reaches it:

$ bash -c 'command_not_found_handle(){ echo HOOK; }; ./nope; echo rc=$?'
bash: line 1: ./nope: No such file or directory
rc=127

So a fragment statement such as "$TESTS_DIR/test_renamed_away.sh" or ./tools/gone.sh (statement position, rc unchecked) prints an error, sets rc 127 and the section still passes. The same is true of a name exec'd by a launcher (timeout 30 missing_cmd, env X=1 missing_cmd), which exits 127 from the launcher with no hook call.

Repro (plant)

Add "$TESTS_DIR/does_not_exist_plant.sh" as a statement line to any fragment, e.g. tests/sections/1a7-sandbox-source-budgets.sh, then cd tests && EIGS_SUITE_SECTIONS='1a7' bash run_all_tests.sh; echo rc=$? -> No such file or directory, RESULTS: N/N passed, rc=0.

Done when
  • The plant above, run through the real runner (sourced path and EIGS_SUITE_SECTIONS plan path), prints a FAIL naming the section and the missing path, and the run exits nonzero.
  • The same holds for timeout 30 missing_cmd_plant in statement position (rc 127 from a launcher).
  • A selftest drives both plants through the real runner and also shows them green with the new check gutted (the check is the witness).
  • The full suite on Linux shows no new false FAIL (no fragment today legitimately leaves rc 126/127 unchecked, or each such site is fixed in the same PR).

Candidate mechanism: an ERR trap (or a per-statement rc 126/127 check) active while a fragment is sourced; note . f || exit 1 suppresses ERR inside f, so the sourcing line must change.


Generated by Claude Code

Dominant language
C
Stars
3
Forks
7
Avg merge
6h 32m
Merged PRs (30d)
285

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from InauguralSystems/EigenScript

All issues in InauguralSystems/EigenScript

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.