super-linter: Parallel cannot identify the default shell
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Running super-linter images locally fails with multiple error message /bin/sh: BuildFileArrays: not found.
x-ref: https://github.com/super-linter/super-linter/issues/5335#issuecomment-1970164621
Expected Behavior
The parallel command should not fail in this way and the /bin/sh: BuildFileArrays: not found. should not occur.
Super-Linter version
Tested with slim-6.2.0 and slim-latest
Relevant log output
Full log.txt
{
"Seq": 42,
"Host": ":",
"Starttime": 1709166454.902,
"JobRuntime": 0.036,
"Send": 0,
"Receive": 0,
"Exitval": 127,
"Signal": 0,
"Command": "BuildFileArrays /tmp/lint/test/linters/xml/xsd_bad_1.xsd /tmp/lint/test/linters/xml/xsd_good_1.xsd /tmp/lint/test/linters/yaml/yml_bad_1.yml /tmp/lint/test/linters/yaml/yml_good_1.yml /tmp/lint/test/run-super-linter-tests.sh /tmp/lint/test/validate-docker-labels.sh /tmp/lint/version.txt /tmp/lint",
"V": [
"/tmp/lint/test/linters/xml/xsd_bad_1.xsd",
"/tmp/lint/test/linters/xml/xsd_good_1.xsd",
"/tmp/lint/test/linters/yaml/yml_bad_1.yml",
"/tmp/lint/test/linters/yaml/yml_good_1.yml",
"/tmp/lint/test/run-super-linter-tests.sh",
"/tmp/lint/test/validate-docker-labels.sh",
"/tmp/lint/version.txt",
"/tmp/lint"
],
"Stdout": "",
"Stderr": "/bin/sh: BuildFileArrays: not found
"
}
...
/bin/sh: BuildFileArrays: not found
/bin/sh: BuildFileArrays: not found
/bin/sh: BuildFileArrays: not found
/bin/sh: BuildFileArrays: not found
/bin/sh: BuildFileArrays: not found
------
2024-02-29 00:27:35 [FATAL] Error when building the list of files and directories to lint.
2024-02-29 00:27:35 [DEBUG] Captured exit code: 1
2024-02-29 00:27:35 [DEBUG] Removing temporary files and directories
2024-02-29 00:27:35 [DEBUG] LOG_FILE_PATH: /tmp/lint/super-linter.log
2024-02-29 00:27:35 [DEBUG] Skipping the moving of the log file from /tmp/tmp.k9y3EiHek2 to /tmp/lint/super-linter.log
make: *** [lint-codebase] Error 1
Steps To Reproduce
- Clone this repo (super-linter/super-linter)
- git rev-parse HEAD https://github.com/super-linter/super-linter/commit/6c1f40c9031146346142102c3ecca4954671735e
- make SUPER_LINTER_TEST_CONTAINER_URL=ghcr.io/super-linter/super-linter:slim-latest@sha256:5c73796a5ba0a5b6811712bfb2a58cc39346a92ccafd28f570ab46ea16e68e61 lint-codebase | tee log.txt
Anything else?
I believe this is occurring because the SHELL environment variable is not set and gnu parallel is choosing to use /bin/sh as a default even though bash is the desired shell. I suspect this can be resolved by exporting env var SHELL=/bin/bash (or setting this in the dockerfile).
Example from testing in the slim-latest image:
e7bc280fd46d:/# doit() { echo "$@"; }
e7bc280fd46d:/# export -f doit
e7bc280fd46d:/# parallel --will-cite doit ::: 1 2 3
/bin/sh: doit: not found
/bin/sh: doit: not found
/bin/sh: doit: not found
e7bc280fd46d:/# SHELL=$(type -p bash) parallel --will-cite doit ::: 1 2 3
1
2
3
About this issue
- Original URL
- State: open
- Created 4 months ago
- Reactions: 1
- Comments: 19
Maybe we can try with
PARALLEL_SHELLfirst?Ah! We crossed the streams 😃
Yeah, I think so.
Yeah, saw that. We dynamically generate part of the workflow matrix, so I’m thinking about the best way to do this 😉
The GNU parallel manual states, in line with what you observed in its source code:
The shell that started GNU Parallel is
/usr/bin/env bash, as the hashbang specifies, so it’s probably falling thecase you listed above.