From 45b8fb0ae1314abdc5b0364137622214ac8e5b98 Mon Sep 17 00:00:00 2001 From: ibaker Date: Mon, 21 Nov 2022 17:34:53 +0000 Subject: [PATCH] Add `set -eu` to all shell scripts These flags ensure that any errors cause the script to exit (instead of just carrying on) (`-e`) and that any unrecognised substitution variables cause an error instead of silently resolving to an empty string (`-u`). Issues like Issue: google/ExoPlayer#10791 should be more quickly resolved with `set -e` because the script will clearly fail with an error like `make: command not found` which would give the user a clear pointer towards the cause of the problem. #minor-release PiperOrigin-RevId: 490001419 --- libraries/decoder_ffmpeg/src/main/jni/build_ffmpeg.sh | 1 + libraries/decoder_opus/src/main/jni/convert_android_asm.sh | 2 +- .../decoder_vp9/src/main/jni/generate_libvpx_android_configs.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/decoder_ffmpeg/src/main/jni/build_ffmpeg.sh b/libraries/decoder_ffmpeg/src/main/jni/build_ffmpeg.sh index fef653bf6e..1583c1c964 100755 --- a/libraries/decoder_ffmpeg/src/main/jni/build_ffmpeg.sh +++ b/libraries/decoder_ffmpeg/src/main/jni/build_ffmpeg.sh @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +set -eu FFMPEG_MODULE_PATH=$1 NDK_PATH=$2 diff --git a/libraries/decoder_opus/src/main/jni/convert_android_asm.sh b/libraries/decoder_opus/src/main/jni/convert_android_asm.sh index 9c79738439..48b141dca2 100755 --- a/libraries/decoder_opus/src/main/jni/convert_android_asm.sh +++ b/libraries/decoder_opus/src/main/jni/convert_android_asm.sh @@ -15,7 +15,7 @@ # limitations under the License. # -set -e +set -eu ASM_CONVERTER="./libopus/celt/arm/arm2gnu.pl" if [[ ! -x "${ASM_CONVERTER}" ]]; then diff --git a/libraries/decoder_vp9/src/main/jni/generate_libvpx_android_configs.sh b/libraries/decoder_vp9/src/main/jni/generate_libvpx_android_configs.sh index 18f1dd5c69..b121886070 100755 --- a/libraries/decoder_vp9/src/main/jni/generate_libvpx_android_configs.sh +++ b/libraries/decoder_vp9/src/main/jni/generate_libvpx_android_configs.sh @@ -18,7 +18,7 @@ # a bash script that generates the necessary config files for libvpx android ndk # builds. -set -e +set -eu if [ $# -ne 0 ]; then echo "Usage: ${0}"