-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Shell: Address various shellcheck issues and formatting #3548
base: main
Are you sure you want to change the base?
Changes from all commits
8f192a3
7306341
bba2c8c
b83fddf
5368efb
182478b
865b79d
ba3b9cd
9594172
882ea97
f2c4bdf
9089e1e
eb93acc
9ceeaa4
00e99ae
556efc7
cfd93f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,10 +19,10 @@ fi | |||||
# Adding -Werror to make's CFLAGS is a workaround for configuring with | ||||||
# an old version of configure, which issues compiler warnings and | ||||||
# errors out. This may be removed with upgraded configure.in file. | ||||||
makecmd="make" | ||||||
if [[ "$#" -ge 2 ]]; then | ||||||
makecmd=("make") | ||||||
if [[ $# -ge 2 ]]; then | ||||||
ARGS=("$@") | ||||||
makecmd="make CFLAGS='$CFLAGS ${ARGS[@]:1}' CXXFLAGS='$CXXFLAGS ${ARGS[@]:1}'" | ||||||
makecmd=("make" "CFLAGS=$CFLAGS ${ARGS[@]:1}" "CXXFLAGS=$CXXFLAGS ${ARGS[@]:1}") | ||||||
fi | ||||||
|
||||||
# non-existent variables as an errors | ||||||
|
@@ -52,5 +52,5 @@ export INSTALL_PREFIX=$1 | |||||
--with-fftw \ | ||||||
--with-netcdf | ||||||
|
||||||
eval $makecmd | ||||||
"${makecmd[@]}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't quite the same. When having the quoted $makecmd, the arguments aren't split. Having unquoted $makecmd is problematic for globs, or all reasons why you'd want to quote variables. Double quoted array with See https://www.shellcheck.net/wiki/SC2086 for general quoting tips (near the end), and https://www.shellcheck.net/wiki/SC2068 and https://www.shellcheck.net/wiki/SC2048 and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This goes with above suggestion. |
||||||
make install |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,10 @@ fi | |
# Adding -Werror to make's CFLAGS is a workaround for configuring with | ||
# an old version of configure, which issues compiler warnings and | ||
# errors out. This may be removed with upgraded configure.in file. | ||
makecmd="make" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See build_ubuntu-22.04.sh |
||
if [[ "$#" -eq 2 ]]; then | ||
makecmd="make CFLAGS='$CFLAGS $2' CXXFLAGS='$CXXFLAGS $2'" | ||
makecmd=("make") | ||
if [[ $# -ge 2 ]]; then | ||
ARGS=("$@") | ||
makecmd=("make" "CFLAGS=$CFLAGS ${ARGS[@]:1}" "CXXFLAGS=$CXXFLAGS ${ARGS[@]:1}") | ||
fi | ||
|
||
# non-existent variables as an errors | ||
|
@@ -50,5 +51,5 @@ export INSTALL_PREFIX=$1 | |
--with-fftw \ | ||
--with-netcdf | ||
|
||
eval $makecmd | ||
"${makecmd[@]}" | ||
make install |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -39,7 +39,7 @@ CONFIGURE_FLAGS="\ | |||||
--with-cairo \ | ||||||
--with-cairo-includes=${CONDA_PREFIX}/include/cairo \ | ||||||
--with-cairo-libs=${CONDA_PREFIX}/lib \ | ||||||
--with-cairo-ldflags="-lcairo" \ | ||||||
--with-cairo-ldflags=-lcairo \ | ||||||
--with-zstd \ | ||||||
--with-zstd-libs=${CONDA_PREFIX}/lib \ | ||||||
--with-zstd-includes=${CONDA_PREFIX}/include \ | ||||||
|
@@ -70,7 +70,7 @@ export CPPFLAGS="-isystem${CONDA_PREFIX}/include" | |||||
./configure $CONFIGURE_FLAGS | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This I wasn't sure that it would work on posix shell on Mac, and didn't know the complete side effects There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What shellcheck suggest is the same on Mac. |
||||||
|
||||||
EXEMPT="-Wno-error=deprecated-non-prototype -Wno-error=strict-prototypes" | ||||||
make -j$(sysctl -n hw.ncpu) CFLAGS="$CFLAGS -Werror $EXEMPT" \ | ||||||
CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" | ||||||
make -j"$(sysctl -n hw.ncpu)" CFLAGS="$CFLAGS -Werror $EXEMPT" \ | ||||||
CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" | ||||||
|
||||||
make install |
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, I'd suggest to refactor, to make things more clear: