changeset 1179:c364e01dcdc6

Make the environment sanitize logic slightly more robust in the face of multi-line environment variable values.
author Rob Landley <rob@landley.net>
date Mon, 26 Jul 2010 01:42:00 -0500
parents 80693b1a8038
children 469a6ce14829
files sources/utility_functions.sh
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sources/utility_functions.sh	Mon Jul 26 00:06:58 2010 -0500
+++ b/sources/utility_functions.sh	Mon Jul 26 01:42:00 2010 -0500
@@ -11,7 +11,7 @@
 {
   # Which variables are set in config?
 
-  TEMP=$(echo $(sed -n 's/.*export[ \t]*\([^=]*\).*/\1/p' config) | sed 's/ /,/g')
+  TEMP=$(echo $(sed -n 's/.*export[ \t]*\([^=]*\)=.*/\1/p' config) | sed 's/ /,/g')
 
   # What other variables should we keep?
 
@@ -20,13 +20,13 @@
 
   # Unset any variable we don't recognize.  It can screw up the build.
 
-  for i in $(env | sed 's/=.*//')
+  for i in $(env | sed -n 's/=.*//p')
   do
     is_in_list $i "$TEMP" && continue
     [ "${i:0:7}" == "DISTCC_" ] && continue
     [ "${i:0:7}" == "CCACHE_" ] && continue
 
-    unset $i
+    unset $i 2>/dev/null
   done
 }