Skip to content

scripts/test.sh hangs indefinitely at the venue-parity contract when ImageMagick is installed (bash runs generate-sbom.py, 'import' becomes ImageMagick) #1384

Description

@OmerZeyveli

Version: main (d698db8e) · Platform: Ubuntu 24.04, x86_64, gcc 13.3

What happens

scripts/test.sh hangs forever at Step 0j on any machine that has ImageMagick installed. No error, no timeout — the process just sleeps indefinitely, after printing:

=== Step 0j: venue parity contract (one harness, every venue) ===
venue-parity contract OK (22 workflows marker-checked, 10 venue workflows whitelist-walked, 4 deliberate step exemptions)

Root cause

tests/test_venue_parity_contract.sh probes every entry point with bash:

for entry in $HELP_ENTRIES; do
    out=$(cd "$ROOT" && bash "$entry" --help 2>&1) && rc=0 || rc=$?

HELP_ENTRIES contains one Python file, scripts/ci/generate-sbom.py. Running it under bash makes the shell interpret Python source as shell commands, so the module imports become commands:

$ ps -o pid,cmd -p 2153369
2153369 import datetime

On Linux import is ImageMagick's screen-capture tool, which blocks waiting for the user to click a window:

$ command -v import
/usr/bin/import
$ import --version
Version: ImageMagick 6.9.12-98 Q16 x86_64

So the probe waits on an X11 window selection that will never come. </dev/null does not help — import waits on the display, not stdin.

CI almost certainly does not hit this because container images generally lack ImageMagick. It reproduces reliably on a desktop Linux developer machine, which is exactly where CONTRIBUTING tells contributors to run scripts/test.sh before submitting.

Minimal reproduction

bash scripts/ci/generate-sbom.py --help     # hangs forever with ImageMagick installed

A second, quieter consequence

Because the probe has always run this file under bash, the contract has never actually verified generate-sbom.py's --help behaviour — it has only ever checked bash's misinterpretation of it. Under the correct interpreter the script does satisfy the contract:

$ python3 scripts/ci/generate-sbom.py --help
Generate the release SPDX SBOM (sbom.json).
...
$ echo $?
0

(generate-sbom.py:22 handles -h/--help and exits 0.)

Suggested fix

Choose the interpreter by extension rather than assuming bash. Note generate-sbom.py is not executable (-rw-rw-r--), so invoking ./"$entry" directly would fail on permissions — the interpreter has to be explicit, or the exec bit added:

 for entry in $HELP_ENTRIES; do
-    out=$(cd "$ROOT" && bash "$entry" --help 2>&1) && rc=0 || rc=$?
+    case "$entry" in
+    *.py) probe_runner=python3 ;;
+    *)    probe_runner=bash ;;
+    esac
+    out=$(cd "$ROOT" && "$probe_runner" "$entry" --help 2>&1) && rc=0 || rc=$?

The same applies to the STRICT_ENTRIES loop below it, which currently happens to contain only shell scripts — worth guarding anyway so a future .py entry does not reintroduce this.

Happy to send a PR if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority/normalStandard review queue; useful PR with ordinary maintainer urgency.stability/performanceServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions