Alex Thiessen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/40945 )
Change subject: util/scripts/ucode_h_to_bin.sh: Fix `shellcheck` warning ......................................................................
util/scripts/ucode_h_to_bin.sh: Fix `shellcheck` warning
The attempted fix in commit 21530bd4 "util/scripts/ucode_h_to_bin.sh: Drop disruptive quotes" triggers a `shellcheck` warning because a string is being split implicitly:
In util/scripts/ucode_h_to_bin.sh line 52: for UCODE in ${@:2}; do ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
Reference: https://github.com/koalaman/shellcheck/wiki/SC2068
Also, accidental globbing will occur, e.g. when a file name contains an asterisk or a question mark.
The underlying reason for this weirdness is this script's interface which is neither _usual_ nor well-documented (the code accepts things which don't adhere to the interface, e.g. multiple file lists or whole directory names).
Make the split explicit by introducing a separate array variable containing the strings, split on spaces. This also will not trigger globbing.
Change-Id: I5fb7d0370ca46e8eb850449612d201d5d164fb6a Signed-off-by: Alex Thiessen alex.thiessen.de+coreboot@gmail.com --- M util/scripts/ucode_h_to_bin.sh 1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/40945/1
diff --git a/util/scripts/ucode_h_to_bin.sh b/util/scripts/ucode_h_to_bin.sh index cb403a4..1072bb9 100755 --- a/util/scripts/ucode_h_to_bin.sh +++ b/util/scripts/ucode_h_to_bin.sh @@ -49,7 +49,9 @@ fi }
-for UCODE in ${@:2}; do +IFS=' ' read -r -a UCODE_PARAM <<< "${@:2}" + +for UCODE in "${UCODE_PARAM[@]}"; do if [ -d "$UCODE" ]; then for f in "$UCODE/"*.inc do
Alex Thiessen has uploaded a new patch set (#2). ( https://review.coreboot.org/c/coreboot/+/40945 )
Change subject: util/scripts/ucode_h_to_bin.sh: Fix `shellcheck` warning ......................................................................
util/scripts/ucode_h_to_bin.sh: Fix `shellcheck` warning
The attempted fix in commit 21530bd4 "util/scripts/ucode_h_to_bin.sh: Drop disruptive quotes" triggers a `shellcheck` warning because a string is being split implicitly:
In util/scripts/ucode_h_to_bin.sh line 52: for UCODE in ${@:2}; do ^-- SC2068: Double quote array expansions to avoid re-splitting elements.
Reference: https://github.com/koalaman/shellcheck/wiki/SC2068
Also, accidental globbing will occur, e.g. when a file name contains an asterisk or a question mark.
The underlying reason for this weirdness is this script's interface which is neither _usual_ nor well-documented (the code accepts things which don't adhere to the interface, e.g. multiple file lists or whole directory names).
Make the split explicit by introducing a separate array variable containing the strings, split on spaces. This also will not trigger globbing.
Change-Id: I5fb7d0370ca46e8eb850449612d201d5d164fb6a Signed-off-by: Alex Thiessen alex.thiessen.de+coreboot@gmail.com --- M util/scripts/ucode_h_to_bin.sh 1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/40945/2
Alex Thiessen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40945 )
Change subject: util/scripts/ucode_h_to_bin.sh: Fix `shellcheck` warning ......................................................................
Patch Set 2:
please verify if the script works as expected
Stefan Reinauer has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/40945?usp=email )
Change subject: util/scripts/ucode_h_to_bin.sh: Fix `shellcheck` warning ......................................................................
Abandoned