You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: the javac wrapper scip-java generates for Maven builds (via -Dmaven.compiler.executable=<tmp>/bin/javac) crashes under bash 3.2 — the only bash macOS ships by default.
Repro: any Maven-built Java project, scip-java index, on macOS with the default /bin/bash (3.2.57):
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile
(default-compile): Fatal error compiling: Could not retrieve version from
<tmp>/scip-java<N>/bin/javac. Exit code 1, Output:
<tmp>/scip-java<N>/bin/javac: line 38: LAUNCHER_ARGS[@]: unbound variable
LAUNCHER_ARGS only ever collects -J* flags. maven-compiler-plugin's version probe (javac -version, used to validate the configured compiler executable before the real build) invokes the wrapper with no -J flags, so the array stays empty.
Under set -u, expanding an empty array ("${arr[@]}") is an error on bash < 4.4 — confirmed directly:
$ /bin/bash --version | head -1
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin25)
$ /bin/bash -c 'set -eu; A=(); echo "${A[@]}"'
/bin/bash: A[@]: unbound variable
macOS has shipped only bash 3.2 as /bin/bash for over a decade (GPLv3 licensing), and does not include a newer bash by default. This means every Maven-built Java project fails to index on macOS unless the user happens to already have a newer bash earlier on PATH than /bin/bash — the wrapper's #!/usr/bin/env bash shebang resolves through PATH, so this is enough to work around it without patching scip-java, but it shouldn't be necessary.
Both JAVAC_JVM_OPTIONS and LAUNCHER_ARGS are exposed to this on line 38.
Suggested fix: bash-3.2-safe expansion, so the wrapper works regardless of which bash version is on PATH:
(${arr[@]+"${arr[@]}"} expands to nothing when arr is unset/empty and to the normal quoted-expansion otherwise — safe on every bash version, no set -u interaction.)
Happy to send a PR with this one-line change if useful.
Activity