-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cc: convert compiler wrappers to POSIX sh #25557
Conversation
Fixes the following shellcheck issues: * https://github.com/koalaman/shellcheck/wiki/SC3011 * https://github.com/koalaman/shellcheck/wiki/SC3024 * https://github.com/koalaman/shellcheck/wiki/SC3030 * https://github.com/koalaman/shellcheck/wiki/SC3045 * https://github.com/koalaman/shellcheck/wiki/SC3053 * https://github.com/koalaman/shellcheck/wiki/SC3054 The "only" things left to fix are arrays, read, heredocs, and other some trivial things we can work around
@haampie: what is the issue with heredocs? They're supported by Bourne shell so not sure why they're listed as needed. |
Looks like the initial changes weren't entirely sound -- tests are failing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSIX shells do not support arrays, cf. StackOverflow: Arrays in unix shell? Error message on Alpine Linux with Ash:
/home/john/spack/lib/spack/env/gcc/gcc: line 26: syntax error: unexpected "("
@@ -78,10 +78,10 @@ IFS=' ' read -ra SPACK_LDFLAGS <<< "$SPACK_LDFLAGS" | |||
IFS=' ' read -ra SPACK_LDLIBS <<< "$SPACK_LDLIBS" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Here strings (
<<<
) are a POSIX feature read -a
creates an array; POSIX shells do not feature arrays; dash complains withdash: 1: read: Illegal option -a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSIX shells do not support arrays, cf. StackOverflow: Arrays in unix shell? Error message on Alpine Linux with Ash:
/home/john/spack/lib/spack/env/gcc/gcc: line 26: syntax error: unexpected "("
Why not Python?
|
Yep, this is about removing arrays and emulating them -- see http://www.etalabs.net/sh_tricks.html. |
It'd be great if we could. In fact, we started this way. If you go back to 0f3b80c (in 2014), you'll see that we replaced the then-python version with |
I see.
😬 Have you considered having the shell code generated? |
Thank you for the link to the commit. |
@christoph-conrads see #25380 (comment) and below |
Generating the compiler wrapper, benchmarks, everything. You've discussed all approaches that came to my mind. |
closing this as @cosmicexplorer is working on #26048. |
Fixes #8703.
Closes #25380.
Putting up an initial PR to start the process of converting
cc
to POSIX shell.Remaining to do:
shellcheck
-based fixesread