Skip to content

Commit

Permalink
Rollup merge of rust-lang#78666 - sasurau4:fix/shellcheck-error, r=jy…
Browse files Browse the repository at this point in the history
…n514

Fix shellcheck error

## Overview

Helps with rust-lang#77290

This pr fix only errors of shellcheck, the result of `git ls-files '*.sh' | xargs shellcheck --severity=error`.

Fixing error are following.

- https://github.com/koalaman/shellcheck/wiki/SC2148
- https://github.com/koalaman/shellcheck/wiki/SC1008

Disable error following.
- https://github.com/koalaman/shellcheck/wiki/SC2068
  • Loading branch information
JohnTitor authored Nov 6, 2020
2 parents c990a38 + 5ea028e commit 7931b24
Show file tree
Hide file tree
Showing 38 changed files with 47 additions and 23 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/scripts/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cmd=$1
shift || true

if [[ "$cmd" = "jit" ]]; then
cargo +${TOOLCHAIN} rustc $@ -- --jit
cargo +${TOOLCHAIN} rustc "$@" -- --jit
else
cargo +${TOOLCHAIN} $cmd $@
cargo +${TOOLCHAIN} $cmd "$@"
fi
1 change: 1 addition & 0 deletions compiler/rustc_codegen_cranelift/scripts/config.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
set -e

unamestr=`uname`
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ set -e

export RUSTFLAGS="-Zrun_dsymutil=no"

./build.sh --without-sysroot $@
./build.sh --without-sysroot "$@"

rm -r target/out || true

scripts/tests.sh no_sysroot

./build.sh $@
./build.sh "$@"

scripts/tests.sh base_sysroot
scripts/tests.sh extended_sysroot
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-powerpc64-linux/shared.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
hide_output() {
set +x
on_err="
Expand All @@ -8,7 +9,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-powerpc64le-linux/shared.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
hide_output() {
set +x
on_err="
Expand All @@ -8,7 +9,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

# Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/dist-various-1/build-rumprun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
rm /tmp/build.log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

mkdir /usr/local/mips-linux-musl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

mkdir /usr/local/mipsel-linux-musl
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-various-2/shared.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
hide_output() {
{ set +x; } 2>/dev/null
on_err="
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-x86_64-linux/shared.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
hide_output() {
set +x
on_err="
Expand All @@ -8,7 +9,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/android-base-apt-get.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

apt-get update
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/android-ndk.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

URL=https://dl.google.com/android/repository
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/android-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

export ANDROID_HOME=/android/sdk
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/cross-apt-packages.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
apt-get update && apt-get install -y --no-install-recommends \
automake \
bison \
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/crosstool-ng-1.24.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

# Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/crosstool-ng.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

url="https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.22.0.tar.gz"
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/scripts/emscripten.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

hide_output() {
Expand All @@ -10,7 +11,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
rm -f /tmp/build.log
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/scripts/freebsd-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
local ping_loop_pid=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $ping_loop_pid
set -x
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/make3.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

curl -f https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf -
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/scripts/musl-toolchain.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
# This script runs `musl-cross-make` to prepare C toolchain (Binutils, GCC, musl itself)
# and builds static libunwind that we distribute for static target.
#
Expand All @@ -19,7 +20,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
rm /tmp/build.log
Expand Down
5 changes: 3 additions & 2 deletions src/ci/docker/scripts/musl.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

hide_output() {
Expand All @@ -10,7 +11,7 @@ exit 1
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
"$@" &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
rm /tmp/build.log
Expand All @@ -32,7 +33,7 @@ if [ ! -d $MUSL ]; then
fi

cd $MUSL
./configure --enable-optimize --enable-debug --disable-shared --prefix=/musl-$TAG $@
./configure --enable-optimize --enable-debug --disable-shared --prefix=/musl-$TAG "$@"
if [ "$TAG" = "i586" -o "$TAG" = "i686" ]; then
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
else
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/rustbuild-setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/scripts/sccache.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -ex

case "$(uname -m)" in
Expand Down
1 change: 1 addition & 0 deletions src/ci/init_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ modules=($modules)
use_git=""
urls="$(git config --file .gitmodules --get-regexp '\.url$' | cut -d' ' -f2)"
urls=($urls)
# shellcheck disable=SC2068
for i in ${!modules[@]}; do
module=${modules[$i]}
if [[ " $included " = *" $module "* ]]; then
Expand Down
1 change: 1 addition & 0 deletions src/ci/shared.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/false
# shellcheck shell=bash

# This file is intended to be sourced with `. shared.sh` or
# `source shared.sh`, hence the invalid shebang and not being
Expand Down
1 change: 1 addition & 0 deletions src/test/run-make/thumb-none-qemu/script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -exuo pipefail

CRATE=example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
set -exuo pipefail

function build {
Expand Down

0 comments on commit 7931b24

Please sign in to comment.