configure resolves bash to /bin/sh on macOS, and make deb runs a bash script with dash - #898
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 intoBASH_SHELL, a name no shell presets, with anAS_UNSETin front so the environment cannot preset it either.That makes the obvious fix for #891 safe. The
deb:target rantools/mkdeb.shwith$(SHELL), which is/bin/sh, somake debdied 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.shstays 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.testasserts that the configured shell exists, setsBASH_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 asshfails, the real bash passes.Several test scripts carried a comment saying they avoid bashisms because the harness runs them under a plain
/bin/shon macOS. That is no longer true, so those comments are gone.Closes #895
Closes #891