Rollup merge of #78666 - sasurau4:fix/shellcheck-error, r=jyn514

Fix shellcheck error

## Overview

Helps with #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
This commit is contained in:
Yuki Okushi 2020-11-07 01:02:14 +09:00 committed by GitHub
commit 7931b2454d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 47 additions and 23 deletions

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/usr/bin/env bash
set -e
unamestr=`uname`

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
hide_output() {
set +x
on_err="
@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
hide_output() {
set +x
on_err="
@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
mkdir /usr/local/mips-linux-musl

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
mkdir /usr/local/mipsel-linux-musl

View file

@ -1,3 +1,4 @@
#!/usr/bin/env bash
hide_output() {
{ set +x; } 2>/dev/null
on_err="

View file

@ -1,3 +1,4 @@
#!/bin/sh
hide_output() {
set +x
on_err="
@ -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

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
apt-get update

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
URL=https://dl.google.com/android/repository

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
export ANDROID_HOME=/android/sdk

View file

@ -1,3 +1,4 @@
#!/bin/sh
apt-get update && apt-get install -y --no-install-recommends \
automake \
bison \

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
url="https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.22.0.tar.gz"

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
hide_output() {
@ -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

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
curl -f https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf -

View file

@ -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.
#
@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
hide_output() {
@ -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
@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -ex
case "$(uname -m)" in

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -exuo pipefail
CRATE=example

View file

@ -1,3 +1,4 @@
#!/bin/sh
set -exuo pipefail
function build {