diff options
author | Håkon Hallingstad <hakon@verizonmedia.com> | 2019-08-16 12:49:19 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@verizonmedia.com> | 2019-08-16 12:49:19 +0200 |
commit | d7e83d013fdcda64442f13b3fb6ff3e1b476f062 (patch) | |
tree | dc640e72bce94faf39367fe0661123e2376a0058 /vespabase/src | |
parent | 1852407b2f1219eff0eb4aeb50a7c6c7440d2c28 (diff) |
Preserve PATH for Vespa services
common-env.sh sets PATH, instead of adding to it. This means e.g. binaries
reachable via PATH, but not in these whitelisted locations, are lost. For our
tester application we have a custom image containing a custom maven
installation, reachable with the PATH.
The effect of setting PATH seems to have been to add VESPA_HOME/bin[64] only.
To ensure all programs reachable with the earlier code, is still reachable
after this code change, all earlier paths are prepended to PATH.
Diffstat (limited to 'vespabase/src')
-rwxr-xr-x | vespabase/src/common-env.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vespabase/src/common-env.sh b/vespabase/src/common-env.sh index b3d7a68d030..007ab61f63a 100755 --- a/vespabase/src/common-env.sh +++ b/vespabase/src/common-env.sh @@ -107,6 +107,13 @@ populate_environment () { fi } +prepend_path () { + case ":$PATH:" in + *:"$1":*) ;; + *) PATH="$1:$PATH" ;; + esac +} + add_valgrind_suppressions_file() { if [ -f "$1" ] then @@ -116,14 +123,16 @@ add_valgrind_suppressions_file() { populate_environment -PATH=$VESPA_HOME/bin64:$VESPA_HOME/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/bin:/usr/sbin:/usr/bin export LD_LIBRARY_PATH=$VESPA_HOME/lib64 export MALLOC_ARENA_MAX=1 +prepend_path "$VESPA_HOME/bin64" +prepend_path "$VESPA_HOME/bin" + # how to find the "java" program? # should be available in $VESPA_HOME/bin or JAVA_HOME if [ "$JAVA_HOME" ] && [ -f "${JAVA_HOME}/bin/java" ]; then - PATH="${JAVA_HOME}/bin:${PATH}" + prepend_path "${JAVA_HOME}/bin" fi VESPA_VALGRIND_SUPPREESSIONS_OPT="" |