From cb7d07ec6edbe022654916eb9862ef3ac073a348 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Tue, 4 Oct 2022 13:35:10 -0500 Subject: [PATCH 1/2] Remove trace from link script Fixes #1044 --- sorc/link_workflow.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 348d23595dd..3734f2680b6 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -15,7 +15,7 @@ Usage: ${BASH_SOURCE[0]} [-h][-o] EOF exit 1 } -set -eux +set -eu RUN_ENVIR="EMC" From 1c74f6724f0ec1c4fe30a550eceef2b80dc81a0a Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Wed, 5 Oct 2022 15:25:53 -0500 Subject: [PATCH 2/2] Add messages when link script exits, fix case error Since removing the trace rendered the link script completely silent, added some messages when it ends. A message reporting the successful completion is added to the bottom. For errors, an ERR trap is added that reports the error, along with the error code and line number. Since UFS utils' `link_fixdirs.sh` turns the trace on, throw away its STDERR. This isn't an ideal solution, but will do for now without changes to UFS utils. Also changed the case of `$RUN_ENVIR` to lowercase to match the strings that are actually checked. Refs: #1044 --- sorc/link_workflow.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 3734f2680b6..1d529d3ca2b 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -2,6 +2,8 @@ #--make symbolic links for EMC installation and hardcopies for NCO delivery +trap 'echo "${BASH_SOURCE[0]} encounted an error at line ${LINENO} (rc=$?)"' ERR + function usage() { cat << EOF Builds all of the global-workflow components by calling the individual build @@ -15,9 +17,10 @@ Usage: ${BASH_SOURCE[0]} [-h][-o] EOF exit 1 } + set -eu -RUN_ENVIR="EMC" +RUN_ENVIR="emc" # Reset option counter in case this script is sourced OPTIND=1 @@ -26,7 +29,7 @@ while getopts ":ho" option; do h) usage ;; o) echo "-o option received, configuring for NCO" - RUN_ENVIR="NCO";; + RUN_ENVIR="nco";; :) echo "[${BASH_SOURCE[0]}]: ${option} requires an argument" usage @@ -105,7 +108,7 @@ done if [ -d "${script_dir}/ufs_utils.fd" ]; then cd "${script_dir}/ufs_utils.fd/fix" || exit 1 - ./link_fixdirs.sh "${RUN_ENVIR}" "${machine}" + ./link_fixdirs.sh "${RUN_ENVIR}" "${machine}" 2> /dev/null fi @@ -420,6 +423,7 @@ if [[ "${RUN_ENVIR}" == "nco" ]] ; then fi #------------------------------ +echo "${BASH_SOURCE[0]} completed successfully" exit 0