summaryrefslogtreecommitdiff
path: root/automated/lib
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-25 09:18:16 +0100
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-25 09:27:22 +0100
commitec8e5a871d98cc16ebb3fee1e2124f292fa13c30 (patch)
tree619c3ef6bc550eb4fd8c378e78d95a3a6530b9c1 /automated/lib
parent76179f4e8efddd36e2910bf1edf166486c03447e (diff)
automated: sh-test-lib: do not source /etc/lsb-release
If /etc/lsb-release file exists , then it will be sourced in dist_name() so any variable defined in this file will override/pollute our existing environment. Since dist_name() is called in the context of the test script, we might end up polluting our test environment with unneeded variable, or even worse we might override variables that we have set in our test scripts... Instead of sourcing the file in the current env, let's do it in a subshell. Change-Id: I99ff9b7bb498f47f01adfe0d21f9b1cce0ebf2cc Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Diffstat (limited to 'automated/lib')
-rwxr-xr-xautomated/lib/sh-test-lib4
1 files changed, 2 insertions, 2 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index 29fd8f9..39b65cd 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -154,8 +154,8 @@ dist_name() {
if [ -x /usr/bin/lsb_release ]; then
dist="$(lsb_release -si)"
elif [ -f /etc/lsb-release ]; then
- . /etc/lsb-release
- dist="${DISTRIB_ID}"
+ # shellcheck disable=SC1091
+ dist="$(. /etc/lsb-release && echo "${DISTRIB_ID}")"
elif [ -f /etc/debian_version ]; then
dist="Debian"
elif [ -f /etc/fedora-release ]; then