Skip to content
Snippets Groups Projects
Commit 65fdc5f2 authored by Simon McVittie's avatar Simon McVittie
Browse files

wrap: Defend against arrays with empty values

parent 46b5570c
Branches
Tags
No related merge requests found
...@@ -292,7 +292,7 @@ if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then ...@@ -292,7 +292,7 @@ if [ -z "$BWRAP" ] || ! "$BWRAP" --bind / / true; then
echo "$me: Falling back to executing '${wrapped_command[*]}' directly" >&2 echo "$me: Falling back to executing '${wrapped_command[*]}' directly" >&2
exec env -- "${env_if_host[@]}" "${wrapped_command[@]}" exec env -- ${env_if_host+"${env_if_host[@]}"} "${wrapped_command[@]}"
fi fi
if "$BWRAP" --help 2>&1 | grep -F '[--]' >/dev/null 2>/dev/null; then if "$BWRAP" --help 2>&1 | grep -F '[--]' >/dev/null 2>/dev/null; then
...@@ -688,7 +688,7 @@ fi ...@@ -688,7 +688,7 @@ fi
# used for them, which might be their physical rather than logical # used for them, which might be their physical rather than logical
# locations # locations
adjusted_ld_preload= adjusted_ld_preload=
for preload in "${ld_preload[@]}"; do for preload in ${ld_preload+"${ld_preload[@]}"}; do
# Currently the only preloaded modules we support are ones that come # Currently the only preloaded modules we support are ones that come
# from the host. # from the host.
preload="${preload#host:}" preload="${preload#host:}"
...@@ -757,7 +757,7 @@ fi ...@@ -757,7 +757,7 @@ fi
if [ -z "$runtime" ]; then if [ -z "$runtime" ]; then
# We need libraries from the Steam Runtime, so make sure that's visible # We need libraries from the Steam Runtime, so make sure that's visible
# (it should never need to be read/write though) # (it should never need to be read/write though)
for env in "${env_if_host[@]}"; do for env in ${env_if_host+"${env_if_host[@]}"}; do
case "$env" in case "$env" in
(STEAM_RUNTIME=/*) (STEAM_RUNTIME=/*)
value="${env#STEAM_RUNTIME=}" value="${env#STEAM_RUNTIME=}"
...@@ -766,7 +766,7 @@ if [ -z "$runtime" ]; then ...@@ -766,7 +766,7 @@ if [ -z "$runtime" ]; then
esac esac
done done
wrapped_command=(env -- "${env_if_host[@]}" "${wrapped_command[@]}") wrapped_command=(env -- ${env_if_host+"${env_if_host[@]}"} "${wrapped_command[@]}")
fi fi
# Replace this process with bwrap, which replaces itself with the # Replace this process with bwrap, which replaces itself with the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment