From 6bffecc6d794ba91dc29b771c5566a0f5702df23 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 28 Sep 2023 15:11:50 -0400 Subject: [PATCH 1/2] fix: build failures should always exit non-zero --- build-coatjava.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build-coatjava.sh b/build-coatjava.sh index 9ba7ca377..c45468361 100755 --- a/build-coatjava.sh +++ b/build-coatjava.sh @@ -1,5 +1,9 @@ #!/bin/bash +set -e +set -u +set -o pipefail + usage='build-coatjava.sh [-h] [--quiet] [--spotbugs] [--nomaps] [--unittests]' quiet="no" @@ -25,7 +29,7 @@ do quiet="yes" else echo "$usage" - exit + exit 2 fi done @@ -77,7 +81,7 @@ if [ $downloadMaps == "yes" ]; then echo ERROR::::::::::: Could not download field map: echo $webDir/$map echo One option is to download manually into etc/data/magfield and then run this build script with --nomaps - exit + exit 1 fi done cd - From 3e02fb820d293fd77a8ee9601de23a15486f7e4b Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Thu, 28 Sep 2023 15:18:19 -0400 Subject: [PATCH 2/2] fix: unbound empty string checks --- bin/env.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/env.sh b/bin/env.sh index b4d0d2bb8..51e8f1ca4 100644 --- a/bin/env.sh +++ b/bin/env.sh @@ -4,13 +4,13 @@ thisEnv=${BASH_SOURCE[0]:-$0} export CLAS12DIR=$(realpath $(dirname $thisEnv)/..) # Set default field maps (but do not override user's env): -if [ -z "$COAT_MAGFIELD_TORUSMAP" ]; then +if [ -z "${COAT_MAGFIELD_TORUSMAP-}" ]; then export COAT_MAGFIELD_TORUSMAP=Symm_torus_r2501_phi16_z251_24Apr2018.dat fi -if [ -z "$COAT_MAGFIELD_TORUSSECONDARYMAP" ]; then +if [ -z "${COAT_MAGFIELD_TORUSSECONDARYMAP-}" ]; then export COAT_MAGFIELD_TORUSSECONDARYMAP=Full_torus_r251_phi181_z251_25Jan2021.dat fi -if [ -z "$COAT_MAGFIELD_SOLENOIDMAP" ]; then +if [ -z "${COAT_MAGFIELD_SOLENOIDMAP-}" ]; then export COAT_MAGFIELD_SOLENOIDMAP=Symm_solenoid_r601_phi1_z1201_13June2018.dat fi