Skip to content

Commit e8a6a02

Browse files
committed
Quote error messages
As a follow-on to I28aebffce6c5561360a9e44c1abc44b709054c30; make sure we quote the error messages on the way through so they retain their newlines. Change-Id: I493317948264941b4788b100a0b0bc13d2698acf
1 parent 4e16c3d commit e8a6a02

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

functions-common

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ function err {
228228
xtrace=$(set +o | grep xtrace)
229229
set +o xtrace
230230
local msg="[ERROR] ${BASH_SOURCE[2]}:$1 $2"
231-
echo $msg 1>&2;
231+
echo "$msg" 1>&2;
232232
if [[ -n ${LOGDIR} ]]; then
233-
echo $msg >> "${LOGDIR}/error.log"
233+
echo "$msg" >> "${LOGDIR}/error.log"
234234
fi
235235
$xtrace
236236
return $exitcode
@@ -283,7 +283,7 @@ function warn {
283283
xtrace=$(set +o | grep xtrace)
284284
set +o xtrace
285285
local msg="[WARNING] ${BASH_SOURCE[2]}:$1 $2"
286-
echo $msg
286+
echo "$msg"
287287
$xtrace
288288
return $exitcode
289289
}
@@ -1442,11 +1442,11 @@ function _common_systemd_pitfalls {
14421442
read -r -d '' msg << EOF || true # read returns 1 for EOF, but it is ok here
14431443
You are trying to use run_process with sudo, this is not going to work under systemd.
14441444
1445-
If you need to run a service as a user other than $STACK_USER call it with:
1445+
If you need to run a service as a user other than \$STACK_USER call it with:
14461446
14471447
run_process \$name \$cmd \$group \$user
14481448
EOF
1449-
die $LINENO $msg
1449+
die $LINENO "$msg"
14501450
fi
14511451

14521452
if [[ ! "$cmd" =~ ^/ ]]; then
@@ -1456,7 +1456,7 @@ start under systemd.
14561456
14571457
Please update your run_process stanza to have an absolute path.
14581458
EOF
1459-
die $LINENO $msg
1459+
die $LINENO "$msg"
14601460
fi
14611461

14621462
}

0 commit comments

Comments
 (0)