Skip to content

configure resolves bash to /bin/sh on macOS, and make deb runs a bash script with dash - #898

Merged
xroche merged 2 commits into
masterfrom
fix-bash-resolution
Jul 31, 2026
Merged

configure resolves bash to /bin/sh on macOS, and make deb runs a bash script with dash#898
xroche merged 2 commits into
masterfrom
fix-bash-resolution

Conversation

@xroche

@xroche xroche commented Jul 31, 2026

Copy link
Copy Markdown
Owner

configure searched for bash into the BASH variable, which bash itself presets to whatever path it was invoked as. configure re-execs through /bin/sh, and on macOS /bin/sh is a bash, so AC_PATH_PROGS honoured the pre-set value and reported checking for bash... /bin/sh, a bash in sh-mode that rejects process substitution. The search now goes into BASH_SHELL, a name no shell presets, with an AS_UNSET in front so the environment cannot preset it either.

That makes the obvious fix for #891 safe. The deb: target ran tools/mkdeb.sh with $(SHELL), which is /bin/sh, so make deb died on the first bashism on every Debian and Ubuntu box, which is to say on the machines you build the packages on. It now uses $(BASH_SHELL). tools/macos-app.sh stays on $(SHELL): it is POSIX sh on purpose, so shellcheck lints it as sh and a bashism creeping back in fails lint rather than CI.

tests/146_bash-shell.test asserts that the configured shell exists, sets BASH_VERSION, is not in POSIX sh-mode, and parses a process substitution. The version alone would not have caught macOS, since sh-mode bash sets it too, so the sh-mode and process-substitution checks are the ones doing the work. Forcing the variable by hand: dash fails, a bash symlinked as sh fails, the real bash passes.

Several test scripts carried a comment saying they avoid bashisms because the harness runs them under a plain /bin/sh on macOS. That is no longer true, so those comments are gone.

Closes #895
Closes #891

xroche and others added 2 commits July 31, 2026 08:22
… script with dash

AC_PATH_PROGS searched into BASH, which bash presets to its own invocation
path. configure re-execs through /bin/sh, and on macOS that shell is a bash, so
the macro honoured the pre-set value and reported "checking for bash...
/bin/sh": a bash in sh-mode that rejects process substitution. Search into
BASH_SHELL instead, a name no shell presets, with AS_UNSET in front so the
environment cannot preset it either.

That makes the obvious fix for the deb target safe. It ran tools/mkdeb.sh with
$(SHELL), which is /bin/sh, so "make deb" died on the first bashism on every
Debian and Ubuntu box. macos-app.sh stays on $(SHELL): it is POSIX sh on
purpose, so shellcheck lints it as sh.

tests/146_bash-shell.test asserts the configured shell exists, sets
BASH_VERSION, is not in POSIX sh-mode, and parses a process substitution.

Closes #895
Closes #891

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
…er true

The four comment blocks the branch added ran two to five lines where one or two
carry the fact. The 146 header also said the macOS shell rejects "the process
substitution the bundle script uses": tools/macos-app.sh has been POSIX sh with
no process substitution since #890, so the gate is there for tests/local-crawl.sh
and tests/webhttrack-smoke.sh, which is what the comment now says.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) July 31, 2026 06:47
@xroche
xroche merged commit 22c5069 into master Jul 31, 2026
26 checks passed
@xroche
xroche deleted the fix-bash-resolution branch July 31, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant