[PATCH gccmakedep] Fix gccmakedep from mutilates arguments containing "'" or " * "

Matt Turner mattst88 at gmail.com
Fri Dec 3 13:20:10 PST 2010


From: Peter Breitenlohner <peb at mppmu.mpg.de>

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=7414
---
 gccmdep.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gccmdep.cpp b/gccmdep.cpp
index ff4b12a..6c7c05f 100644
--- a/gccmdep.cpp
+++ b/gccmdep.cpp
@@ -32,7 +32,9 @@ while [ $# != 0 ]; do
     else
 	case "$1" in
 	    -D*|-I*|-U*)
-		args="$args '$1'"
+XCOMM arg may contain single quotes
+		qarg=`echo "$1" | sed "s/'/'\\\\\\\\''/g"`
+                args="$args '$qarg'"
 		;;
 	    -g*|-O*)
 		;;
@@ -74,7 +76,8 @@ XCOMM ignore these flags
 			    echo "Unknown option '$1' ignored" 1>&2
 			    ;;
 			*)
-			    files="$files $1"
+XCOMM filename may contain blanks
+			    files="$files '$1'"
 			    ;;
 		    esac
 		fi
@@ -115,7 +118,8 @@ CMD="$CC -M $args $files"
 if [ X"$makefile" != X- ]; then
     CMD="$CMD >> $TMP"
 fi
-eval $CMD
+XCOMM Do not wilcard expand '*' in args
+eval "$CMD"
 if [ X"$makefile" != X- ]; then
     $RM ${makefile}.bak
     $MV $makefile ${makefile}.bak
-- 
1.7.2.2



More information about the xorg-devel mailing list