Skip to content

Commit 3d603af

Browse files
committed
Fix gcc wrappers when invoked with 0 arguments.
`${@}` is a single word, regardless of how many arguments were passed to the program. To expand it as an array, it must be `$@`. See https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html. Fixes the following errors when invoked with 0 arguments: ``` docker/musl-gcc.sh: line 73: @: unbound variable docker/freebsd-gcc.sh: line 16: @: unbound variable ```
1 parent 9bca1e3 commit 3d603af

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docker/freebsd-gcc.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ set -euo pipefail
77

88
main() {
99
if [[ $# -eq 0 ]]; then
10-
exec "${CROSS_TOOLCHAIN_PREFIX}gcc" "${@}"
10+
exec "${CROSS_TOOLCHAIN_PREFIX}gcc"
1111
else
1212
exec "${CROSS_TOOLCHAIN_PREFIX}gcc" "${@}" -lc++ -lstdc++
1313
fi
1414
}
1515

16-
main "${@}"
16+
main "$@"

docker/musl-gcc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ main() {
2727
minor=$(rustc_minor_version)
2828

2929
if [[ $# -eq 0 ]] || [[ "${minor}" -ge "${patched_minor}" ]]; then
30-
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "${@}"
30+
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "$@"
3131
else
32-
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "${@}" -lgcc -static-libgcc
32+
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "$@" -lgcc -static-libgcc
3333
fi
3434
}
3535

@@ -70,4 +70,4 @@ rustc_patch_version() {
7070
echo "${CROSS_RUSTC_PATCH_VERSION}"
7171
}
7272

73-
main "${@}"
73+
main "$@"

0 commit comments

Comments
 (0)