From: Eric Brine Date: Tue, 13 Nov 2012 00:40:49 +0000 (-0500) Subject: Do a better job of escaping components of ldlibpth for the shell X-Git-Tag: upstream/5.20.0~4836 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=937aac54e77dcd55bbcad956420c9f990fc0b4ea;p=platform%2Fupstream%2Fperl.git Do a better job of escaping components of ldlibpth for the shell It's not unusual, for example, for the search path to include "(" and ")" in cygwin. --- diff --git a/Makefile.SH b/Makefile.SH index 7a8399b..97057fd 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -1,5 +1,14 @@ #!/bin/sh +# quote() - Creates a shell literal +# Usage: echo "...$( quote "..." )..." +quote() { + case "$1" in + '') echo "''" ;; + *) echo "$1" | sed 's/\([^a-zA-Z0-9.:_\-\/]\)/\\\1/g' ;; + esac +} + case $PERL_CONFIG_SH in '') if test -f config.sh @@ -39,10 +48,8 @@ true) # Prefix all runs of 'miniperl' and 'perl' with # $ldlibpth so that ./perl finds *this* shared libperl. case "$LD_LIBRARY_PATH" in - '') - ldlibpth="LD_LIBRARY_PATH=`pwd`";; - *) - ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";; + '') ldlibpth="LD_LIBRARY_PATH=$( quote "`pwd`" )" ;; + *) ldlibpth="LD_LIBRARY_PATH=$( quote "`pwd`" ):$( quote "$LD_LIBRARY_PATH" )" ;; esac pldlflags="$cccdlflags" @@ -121,19 +128,19 @@ true) ldlibpth='' ;; *) - eval "ldlibpth=\"$ldlibpthname=`pwd`:\$$ldlibpthname\"" + eval "ldlibpthval=\"\$$ldlibpthname\"" + + case "$ldlibpthval" in + '') ldlibpth="$ldlibpthname=$( quote "`pwd`" )" ;; + *) ldlibpth="$ldlibpthname=$( quote "`pwd`" ):$( quote "$ldlibpthval" )" ;; + esac + ;; esac - # Strip off any trailing :'s - ldlibpth=`echo $ldlibpth | sed 's/:*$//'` + ;; esac - case "$ldlibpth" in - # Protect any spaces - *" "*) ldlibpth=`echo $ldlibpth|sed 's/ /\\\\ /g'` ;; - esac - case "$osname" in linux) # If there is a pre-existing $libperl from a previous