[tor-commits] [torbrowser/master] [Linux] Quote some shell expansion results

erinn at torproject.org erinn at torproject.org
Sun Oct 23 23:18:27 UTC 2011


commit caab38074c7fa416873f368ad9605ec46a5f9c66
Author: Robert Ransom <rransom.8774 at gmail.com>
Date:   Tue Aug 23 02:05:20 2011 -0400

    [Linux] Quote some shell expansion results
    
    At the very least, `pwd` and $HOME need to be enclosed in double quotes
    (so that spaces in directory names won't automatically break things).
    (cherry picked from commit d9c40aa4f2a4e5bf62a6420a514e8f0b1e7a05ca)
---
 src/RelativeLink/RelativeLink.sh |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/RelativeLink/RelativeLink.sh b/src/RelativeLink/RelativeLink.sh
index 63c0414..e33b1a8 100755
--- a/src/RelativeLink/RelativeLink.sh
+++ b/src/RelativeLink/RelativeLink.sh
@@ -7,8 +7,8 @@
 #
 # Copyright 2010 The Tor Project.  See LICENSE for licensing information.
 
-if [ $1 ]; then 
-	debug=$1
+if [ "$1" ]; then
+	debug="$1"
 	printf "\nDebug enabled.\n\n"
 fi
 
@@ -28,7 +28,7 @@ test -d "$mydir" && cd "$mydir"
 # If ${PWD} results in a zero length HOME, we can try something else...
 if [ ! "${PWD}" ]; then
 	# "hacking around some braindamage"
-	HOME=`pwd`
+	HOME="`pwd`"
 	export HOME
 	surveysays="This system has a messed up shell.\n"
 else
@@ -37,12 +37,12 @@ else
 fi
 
 if ldd ./App/Firefox/firefox-bin | grep -q "libz\.so\.1.*not found"; then
-	LD_LIBRARY_PATH=${HOME}/Lib:${HOME}/Lib/libz
+	LD_LIBRARY_PATH="${HOME}/Lib:${HOME}/Lib/libz"
 else
-	LD_LIBRARY_PATH=${HOME}/Lib
+	LD_LIBRARY_PATH="${HOME}/Lib"
 fi
 
-LDPATH=${HOME}/Lib/
+LDPATH="${HOME}/Lib/"
 export LDPATH
 export LD_LIBRARY_PATH
 DYLD_PRINT_LIBRARIES=1
@@ -51,7 +51,7 @@ export DYLD_PRINT_LIBRARIES
 # if any relevant processes are running, inform the user and exit cleanly
 RUNNING=0
 for process in tor vidalia
-        do pid=`pidof $process`
+        do pid="`pidof $process`"
         if [ -n "$pid" ]; then
 		printf "\n$process is already running as PID $pid\n\n"
 		RUNNING=1
@@ -72,7 +72,7 @@ if [ "${debug}" ]; then
 		# this is likely unportable to Mac OS X or other netstat binaries
   		for port in "8118" "9050"
   			do
-			BOUND=`netstat -tan 2>&1|grep 127.0.0.1":${port}[^:]"|grep -v TIME_WAIT`
+			BOUND="`netstat -tan 2>&1|grep 127.0.0.1":${port}[^:]"|grep -v TIME_WAIT`"
 			if [ "${BOUND}" ]; then
 			printf "\nLikely problem detected: It appears that you have something listening on ${port}\n"
 			printf "\nWe think this because of the following: ${BOUND}\n"





More information about the tor-commits mailing list