Skip to content

Commit 9b42d05

Browse files
protections for sourcing files
1 parent 648d801 commit 9b42d05

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

DATA/common/getCommonArgs.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
# used to avoid sourcing this file 2x
4+
if [[ -z $SOURCE_GUARD_GETCOMMONARGS ]]; then
5+
SOURCE_GUARD_GETCOMMONARGS=1
6+
37
if [[ -z $SEVERITY || -z $NUMAID || -z $SHMSIZE || -z $FILEWORKDIR || -z $EPNSYNCMODE || -z $INFOLOGGER_SEVERITY || -z $SHMTHROW || -z $NORATELOG ]]; then
48
echo "Configuration Environment Variable Missing in getCommonArgs.sh" 1>&2
59
exit 1
@@ -18,3 +22,5 @@ fi
1822
[[ $SHMTHROW == 0 ]] && ARGS_ALL+=" --shm-throw-bad-alloc 0"
1923
[[ ! -z $SHM_MANAGER_SHMID && "0$GEN_TOPO_CALIB_WORKFLOW" != "01" ]] && ARGS_ALL+=" --no-cleanup --shm-no-cleanup on --shmid $SHM_MANAGER_SHMID"
2024
[[ $NORATELOG == 1 ]] && ARGS_ALL+=" --fairmq-rate-logging 0"
25+
26+
fi # getCommonArgs.sh sourced

DATA/common/setenv.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
# used to avoid sourcing this file 2x
4+
if [[ -z $SOURCE_GUARD_SETENV ]]; then
5+
SOURCE_GUARD_SETENV=1
6+
37
# Make sure we can open sufficiently many files / allocate enough memory
48
if [[ "0$SETENV_NO_ULIMIT" != "01" ]]; then
59
ulimit -S -n 4096 && ulimit -S -m unlimited && ulimit -S -v unlimited && [[ -z "$GPUTYPE" ]] || [[ "$GPUTYPE" == "CPU" ]] || ulimit -S -l unlimited
@@ -244,3 +248,5 @@ add_semicolon_separated()
244248
fi
245249
done
246250
}
251+
252+
fi # setenv.sh sourced

DATA/common/setenv_calib.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
# if they are not explicitly disabled.
88
# Then, configure data spec according to enabled calibrations
99

10-
source $O2DPG_ROOT/DATA/common/setenv.sh
10+
# used to avoid sourcing this file 2x
11+
if [[ -z $SOURCE_GUARD_SETENV_CALIB ]]; then
12+
SOURCE_GUARD_SETENV_CALIB=1
1113

1214
if [[ $BEAMTYPE != "cosmic" ]] || [[ $FORCECALIBRATIONS == 1 ]] ; then
1315

@@ -142,3 +144,4 @@ get_proxy_connection()
142144
echo $PROXY_CONN
143145

144146
}
147+
fi # setenv_calib.sh sourced

0 commit comments

Comments
 (0)