summaryrefslogtreecommitdiff
path: root/indra/newview/linux_tools
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-03-29 09:53:53 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-03-29 09:53:53 -0400
commit51018f38a25bb9d43775ccd8702525a6f16186fa (patch)
treef55840d5b817e0682fbdbc04db6941b9dfd191e9 /indra/newview/linux_tools
parent8815cfa5c916ac454cfa5b6f22f9ce312b00a846 (diff)
IQA-463: fix Linux wrapper.sh (aka secondlife) gridargs.dat handling.
Previous change to wrapper.sh naively read $(<etc/gridargs.dat) directly into the viewer binary command line. But gridargs.dat contains quoted args as well as simple space-separated ones: need bash to scan the file using eval. This was why the older logic used eval on the entire command line. However, we must use eval only for gridargs.dat so we don't lose individual quoting on arguments passed to the secondlife script.
Diffstat (limited to 'indra/newview/linux_tools')
-rwxr-xr-xindra/newview/linux_tools/wrapper.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index 90771f1174..20936c6460 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -112,11 +112,23 @@ export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}"
+# Have to deal specially with gridargs.dat; typical contents look like:
+# --channel "Second Life Developer" --settings settings_developer.xml
+# Simply embedding $(<etc/gridargs.dat) into a command line treats each of
+# Second, Life and Developer as separate args -- no good. We need bash to
+# process quotes using eval.
+# First read it without scanning, then scan that string. Break quoted words
+# into a bash array. Note that if gridargs.dat is empty, or contains only
+# whitespace, the resulting gridargs array will be empty -- zero entries --
+# therefore "${gridargs[@]}" entirely vanishes from the command line below,
+# just as we want.
+eval gridargs=("$(<etc/gridargs.dat)")
+
# Run the program.
# Don't quote $LL_WRAPPER because, if empty, it should simply vanish from the
-# command line. Similar remarks about the contents of gridargs.dat. But DO
-# quote "$@": preserve separate args as individually quoted.
-$LL_WRAPPER bin/do-not-directly-run-secondlife-bin $(<etc/gridargs.dat) "$@"
+# command line. But DO quote "$@": preserve separate args as individually
+# quoted. Similar remarks about the contents of gridargs.
+$LL_WRAPPER bin/do-not-directly-run-secondlife-bin "${gridargs[@]}" "$@"
LL_RUN_ERR=$?
# Handle any resulting errors