Skip to content

Commit eaf72fb

Browse files
committed
Handle environment vars. with space properly
If you have this env. var: no_proxy=*.local, 169.254/16 it is very hard to get the quoting correct. It is easier to just write the correct entries to the seluser's .bash_aliases file, which will be included by .bashrc when running xvfb-run as the seluser.
1 parent 4f8c67d commit eaf72fb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

StandaloneDebug/entry_point.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ fi
1818
rm -f /tmp/.X*lock
1919

2020
SERVERNUM=$(get_server_num)
21-
env | cut -f 1 -d "=" | sort > asroot
22-
sudo -E -u seluser -i env | cut -f 1 -d "=" | sort > asseluser
21+
22+
env | sort -k 1 -t '=' > asroot
23+
sudo -E -u seluser -i env | sort -k 1 -t '=' > asseluser
24+
25+
# The .bash_aliases file will run when starting xvfb with the seluser below
26+
join -v 1 -j 1 -t '=' --nocheck-order asroot asseluser > /home/seluser/.bash_aliases
27+
2328
sudo -E -i -u seluser \
24-
$(for E in $(grep -vxFf asseluser asroot); do echo $E=$(eval echo \$$E); done) \
2529
DISPLAY=$DISPLAY \
2630
xvfb-run -n $SERVERNUM --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
2731
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \

0 commit comments

Comments
 (0)