Skip to content

Commit 72664dd

Browse files
authored
Remove set -x from gcc wrappers and fix behavior with 0 arguments (#1728)
Fixes #1618. Additionally fixes the behavior 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. ``` docker/musl-gcc.sh: line 73: @: unbound variable docker/freebsd-gcc.sh: line 16: @: unbound variable ```
2 parents 49cd054 + 3d603af commit 72664dd

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

docker/freebsd-gcc.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
# the freebsd images need libstdc++ to be linked as well
44
# otherwise, we get `undefined reference to `std::ios_base::Init::Init()'`
55

6-
set -x
76
set -euo pipefail
87

98
main() {
109
if [[ $# -eq 0 ]]; then
11-
exec "${CROSS_TOOLCHAIN_PREFIX}gcc" "${@}"
10+
exec "${CROSS_TOOLCHAIN_PREFIX}gcc"
1211
else
1312
exec "${CROSS_TOOLCHAIN_PREFIX}gcc" "${@}" -lc++ -lstdc++
1413
fi
1514
}
1615

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

docker/musl-gcc.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# missing soft-fp routine `__trunctfsf2`
2020
# https://github.com/rust-lang/compiler-builtins/pull/483
2121

22-
set -x
2322
set -euo pipefail
2423

2524
main() {
@@ -28,9 +27,9 @@ main() {
2827
minor=$(rustc_minor_version)
2928

3029
if [[ $# -eq 0 ]] || [[ "${minor}" -ge "${patched_minor}" ]]; then
31-
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "${@}"
30+
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "$@"
3231
else
33-
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "${@}" -lgcc -static-libgcc
32+
exec "${CROSS_TOOLCHAIN_PREFIX}"gcc "$@" -lgcc -static-libgcc
3433
fi
3534
}
3635

@@ -71,4 +70,4 @@ rustc_patch_version() {
7170
echo "${CROSS_RUSTC_PATCH_VERSION}"
7271
}
7372

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

0 commit comments

Comments
 (0)