c460ee
From 3eaf937e69fe4219738c93d39af1cc909b1ee3f8 Mon Sep 17 00:00:00 2001
c460ee
From: Rinku Kothiya <rkothiya@redhat.com>
c460ee
Date: Fri, 23 Apr 2021 09:30:35 +0000
c460ee
Subject: [PATCH 544/584] tests: avoid empty paths in environment variables
c460ee
c460ee
Many variables containing paths in env.rc.in are defined in a way
c460ee
that leave a trailing ':' in the variable when the previous value
c460ee
was empty or undefined.
c460ee
c460ee
In the particular case of 'LD_PRELOAD_PATH' variable, this causes
c460ee
that the system looks for dynamic libraries in the current working
c460ee
directory. When this directory is inside a Gluster mount point, a
c460ee
significant delay is caused each time a program is run (and testing
c460ee
framework can run lots of programs for each test).
c460ee
c460ee
This patch prevents that variables containing paths could end with
c460ee
a trailing ':'.
c460ee
c460ee
Backport of :
c460ee
>Upstream-patch-link: https://github.com/gluster/glusterfs/pull/2349
c460ee
>Fixes: #2348
c460ee
>Change-Id: I669f5a78e14f176c0a58824ba577330989d84769
c460ee
>Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
c460ee
>Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
c460ee
c460ee
Change-Id: Ie903ca443aa4789553ac4687818a7f69c113af41
c460ee
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
c460ee
---
c460ee
 tests/env.rc.in | 17 +++++++----------
c460ee
 1 file changed, 7 insertions(+), 10 deletions(-)
c460ee
c460ee
diff --git a/tests/env.rc.in b/tests/env.rc.in
c460ee
index 1f0ca88..2d8ff0e 100644
c460ee
--- a/tests/env.rc.in
c460ee
+++ b/tests/env.rc.in
c460ee
@@ -2,34 +2,31 @@ prefix=@prefix@
c460ee
 exec_prefix=@exec_prefix@
c460ee
 libdir=@libdir@
c460ee
 
c460ee
-PATH=@sbindir@:$PATH
c460ee
+PATH=@bindir@:@sbindir@${PATH:+:${PATH}}
c460ee
 export PATH
c460ee
 
c460ee
 GLUSTERD_PIDFILEDIR=@localstatedir@/run/gluster
c460ee
 export GLUSTERD_PIDFILEDIR
c460ee
 
c460ee
-LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
c460ee
+LD_LIBRARY_PATH=@libdir@${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
c460ee
 export LD_LIBRARY_PATH
c460ee
 
c460ee
-LIBRARY_PATH=@libdir@:$LIBRARY_PATH
c460ee
+LIBRARY_PATH=@libdir@${LIBRARY_PATH:+:${LIBRARY_PATH}}
c460ee
 export LIBRARY_PATH
c460ee
 
c460ee
-CPATH=@includedir@:$CPATH
c460ee
+CPATH=@includedir@${CPATH:+:${CPATH}}
c460ee
 export CPATH
c460ee
 
c460ee
 GLUSTERD_WORKDIR=@GLUSTERD_WORKDIR@
c460ee
 export GLUSTERD_WORKDIR
c460ee
 
c460ee
-PKG_CONFIG_PATH=@pkgconfigdir@:$PKG_CONFIG_PATH
c460ee
+PKG_CONFIG_PATH=@pkgconfigdir@${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
c460ee
 export PKG_CONFIG_PATH
c460ee
 
c460ee
-PYTHONPATH=@BUILD_PYTHON_SITE_PACKAGES@:$PYTHON_PATH
c460ee
-export PYTHONPATH
c460ee
-
c460ee
 PYTHON=@PYTHON@
c460ee
 export PYTHON
c460ee
 
c460ee
-PYTHONPATH=@BUILD_PYTHON_SITE_PACKAGES@:$PYTHON_PATH
c460ee
+PYTHONPATH=@BUILD_PYTHON_SITE_PACKAGES@${PYTHONPATH:+:${PYTHONPATH}}
c460ee
 export PYTHONPATH
c460ee
 
c460ee
 GLUSTER_CMD_DIR=@sbindir@
c460ee
@@ -42,4 +39,4 @@ RUN_NFS_TESTS=@BUILD_GNFS@
c460ee
 export RUN_NFS_TESTS
c460ee
 
c460ee
 GLUSTER_XLATOR_DIR=@libdir@/glusterfs/@PACKAGE_VERSION@/xlator
c460ee
-export GLUSTER_XLATOR_DIR
c460ee
\ No newline at end of file
c460ee
+export GLUSTER_XLATOR_DIR
c460ee
-- 
c460ee
1.8.3.1
c460ee