More strict and pervasive quoting of paths and variables - should work better

with directories or files containing spaces in them


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@16724 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2003-05-14 15:10:22 +00:00
parent 6cb1835943
commit 7105ee031e
5 changed files with 103 additions and 97 deletions

View file

@ -1,3 +1,10 @@
Wed May 14 16:15:16 2003 Nicola Pero <n.pero@mi.flashnet.it>
* debugapp.in: Added more strict quoting of paths everywhere.
* executable.template.in: Idem.
* openapp.in: Idem.
* opentool.in: Idem.
Fri May 9 12:22:24 2003 Nicola Pero <n.pero@mi.flashnet.it>
* Documentation/install.texi (Flat Structure): Fixed typo.

View file

@ -25,8 +25,8 @@
# unmodified to the application.
if [ -z "$1" ]; then
echo usage: `basename $0` [--library-combo=...] application [arguments...]
echo `basename $0` --help for help
echo usage: `basename "$0"` [--library-combo=...] application [arguments...]
echo `basename "$0"` --help for help
exit 1
fi
@ -40,9 +40,9 @@ if [ -z "$GDB" ]; then
GDB=gdb
fi
case $1 in
case "$1" in
--help)
echo usage: `basename $0` [--library-combo=...] application [arguments...]
echo usage: `basename "$0"` [--library-combo=...] application [arguments...]
echo
echo [--library-combo=...] specifies a GNUstep backend to use.
echo It overrides the default LIBRARY_COMBO environment variable.
@ -57,16 +57,16 @@ case $1 in
exit 0
;;
--library-combo=*)
LIBRARY_COMBO=`echo $1 | sed 's/--library-combo=//'`
LIBRARY_COMBO=`echo "$1" | sed 's/--library-combo=//'`
if [ -z "$2" ]; then
echo usage: `basename $0` [--library-combo=...] application [arguments...]
echo `basename $0` --help for help
echo usage: `basename "$0"` [--library-combo=...] application [arguments...]
echo `basename "$0"` --help for help
exit 1
fi
app=$2; shift; shift
app="$2"; shift; shift
;;
*)
app=$1; shift;;
app="$1"; shift;;
esac
if [ "$LIBRARY_COMBO" = nx ]; then
@ -80,28 +80,28 @@ elif [ "$LIBRARY_COMBO" = apple ]; then
fi
# Remove leading slashes at the end of the application name
app=`echo $app | sed 's%/*$%%'`
app="`echo \"$app\" | sed 's%/*$%%'`"
case $app in
case "$app" in
/*) # An absolute path.
full_appname=$app;;
full_appname="$app";;
*/*) # A relative path
full_appname=`(cd $app; pwd)`;;
full_appname="`(cd \"$app\"; pwd)`";;
*) # A path that should be searched into the GNUstep paths
if [ -n $GNUSTEP_PATHLIST ]; then
SPATH=$GNUSTEP_PATHLIST
if [ -n "$GNUSTEP_PATHLIST" ]; then
SPATH="$GNUSTEP_PATHLIST"
else
SPATH=$PATH
SPATH="$PATH"
fi
SPATH=.:$SPATH
SPATH=".:$SPATH"
IFS=:
for dir in $SPATH; do
if [ -d $dir/Applications/$app ]; then
full_appname=`(cd $dir/Applications/$app; pwd)`
if [ -d "$dir/Applications/$app" ]; then
full_appname="`(cd \"$dir/Applications/$app\"; pwd)`"
break;
fi
if [ -d $dir/$app ]; then
full_appname=`(cd $dir/$app; pwd)`
if [ -d "$dir/$app" ]; then
full_appname="`(cd \"$dir/$app\"; pwd)`"
break;
fi
done;;
@ -147,40 +147,40 @@ if [ -z "$GNUSTEP_FLATTENED" ]; then
export GNUSTEP_HOST_OS
fi
if [ "$LIBRARY_COMBO" = nx-nx-nx -a $GNUSTEP_HOST_OS = nextstep4 ]; then
if [ "$LIBRARY_COMBO" = nx-nx-nx -a "$GNUSTEP_HOST_OS" = nextstep4 ]; then
if [ -f "$full_appname/library_paths.openapp" ]; then
additional_library_paths="`cat $full_appname/library_paths.openapp`"
additional_library_paths="`cat \"$full_appname/library_paths.openapp\"`"
fi
fi
else
if [ -f "$full_appname/library_paths.openapp" ]; then
additional_library_paths="`cat $full_appname/library_paths.openapp`"
additional_library_paths="`cat \"$full_appname/library_paths.openapp\"`"
fi
fi
appname=`echo $app | sed 's/\.[a-z]*$//'`
appname=`basename $appname`
appname="`echo \"$app\" | sed 's/\.[a-z]*$//'`"
appname="`basename \"$appname\"`"
appname="$appname$EXEEXT"
. $GNUSTEP_SYSTEM_ROOT/@MAKEFILES_SUFFIX@/ld_lib_path.sh
. "$GNUSTEP_SYSTEM_ROOT/@MAKEFILES_SUFFIX@/ld_lib_path.sh"
if [ "$LIBRARY_COMBO" = nx-nx-nx -a $GNUSTEP_HOST_OS = nextstep4 ]; then
if [ ! -f $full_appname/$appname ]; then
if [ "$LIBRARY_COMBO" = nx-nx-nx -a "$GNUSTEP_HOST_OS" = nextstep4 ]; then
if [ ! -f "$full_appname/$appname" ]; then
echo "$full_appname application does not have a binary for this kind of machine and operating system."
exit 1
fi
# Support for GDBbundle under OPENSTEP
$GDB -connect TextEdit $gdbargs $full_appname/$appname $corefile
"$GDB" -connect TextEdit $gdbargs "$full_appname/$appname" "$corefile"
else
# Determine if the application has a binary for this operating system
if [ -z "$GNUSTEP_FLATTENED" -a ! -d $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS ]; then
if [ -z "$GNUSTEP_FLATTENED" -a ! -d "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS" ]; then
echo "$full_appname application does not have a binary for this kind of machine and operating system."
exit 1
fi
if [ -z "$GNUSTEP_FLATTENED" -a ! -d $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO ]; then
if [ -z "$GNUSTEP_FLATTENED" -a ! -d "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO" ]; then
echo "$full_appname application does not have a binary for this combination of libraries: $LIBRARY_COMBO."
exit 1
fi
@ -193,9 +193,9 @@ fi
#Support for GDBbundle under OPENSTEP
if [ $GNUSTEP_HOST_OS = nextstep4 ]; then
$GDB -connect TextEdit $file_appname $corefile
"$GDB" -connect TextEdit "$file_appname" "$corefile"
else
$GDB $file_appname $corefile
"$GDB" "$file_appname" "$corefile"
fi
fi

View file

@ -36,16 +36,16 @@ if [ -z "$LIBRARY_COMBO" ]; then
fi
# Process arguments
app=$0
app="$0"
show_available_platforms=0
show_relative_path=0
show_full_path=0
while true
do
case $1 in
case "$1" in
--script-help)
echo usage: `basename $0` [--library-combo=...]
echo usage: `basename "$0"` [--library-combo=...]
echo " [--available-platforms][--full-executable-path]"
echo " [--relative-executable-path] [arguments...]"
echo
@ -61,7 +61,7 @@ do
--library-combo=*)
tmp_root="$GNUSTEP_SYSTEM_ROOT"
. "$tmp_root/@MAKEFILES_SUFFIX@/GNUstep-reset.sh"
LIBRARY_COMBO=`echo $1 | sed 's/--library-combo=//'`
LIBRARY_COMBO=`echo "$1" | sed 's/--library-combo=//'`
. "$tmp_root/@MAKEFILES_SUFFIX@/GNUstep.sh"
shift
;;
@ -94,28 +94,28 @@ fi
export LIBRARY_COMBO
# Find path to ourself
dir=`dirname $app`
dir="`dirname \"$app\"`"
case $app in
case "$app" in
/*) # An absolute path.
full_appname=$dir;;
full_appname="$dir";;
*/*) # A relative path
full_appname=`(cd $dir; pwd)`;;
full_appname="`(cd \"$dir\"; pwd)`";;
*) # A path that needs to be searched
if [ -n $GNUSTEP_PATHLIST ]; then
SPATH=$GNUSTEP_PATHLIST
if [ -n "$GNUSTEP_PATHLIST" ]; then
SPATH="$GNUSTEP_PATHLIST"
else
SPATH=$PATH
SPATH="$PATH"
fi
SPATH=.:$SPATH
SPATH=".:$SPATH"
IFS=:
for path_dir in $SPATH; do
if [ -d $path_dir/$dir ]; then
full_appname=`(cd $path_dir/$dir; pwd)`
if [ -d "$path_dir/$dir" ]; then
full_appname="`(cd \"$path_dir/$dir\"; pwd)`"
break;
fi
if [ -d $path_dir/Applications/$dir ]; then
full_appname=`(cd $path_dir/Applications/$dir; pwd)`
if [ -d "$path_dir/Applications/$dir" ]; then
full_appname="`(cd \"$path_dir/Applications/$dir\"; pwd)`"
break;
fi
done;;
@ -148,13 +148,13 @@ if [ -f "$full_appname/Resources/Info-gnustep.plist" ]; then
"$full_appname/Resources/Info-gnustep.plist"`
fi
if [ -z "$appname" ]; then
appname=`basename $app`
appname="`basename \"$app\"`"
fi
appname="$appname$EXEEXT"
if [ $show_available_platforms = 1 ]; then
cd $full_appname
cd "$full_appname"
#available_platforms
exit 0
fi
@ -186,18 +186,18 @@ fi
#
# Make sure the executable is there
#
if [ -x $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$appname ]; then
relative_path=$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$appname
elif [ -x $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$appname ]; then
relative_path=$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$appname
elif [ -x $full_appname/$GNUSTEP_HOST_CPU/$appname ]; then
relative_path=$GNUSTEP_HOST_CPU/$appname
elif [ $full_appname/$appname != $0 -a -x $full_appname/$appname ]; then
relative_path=$appname
if [ -x "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$appname" ]; then
relative_path="$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$appname"
elif [ -x "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$appname" ]; then
relative_path="$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$appname"
elif [ -x "$full_appname/$GNUSTEP_HOST_CPU/$appname" ]; then
relative_path="$GNUSTEP_HOST_CPU/$appname"
elif [ "$full_appname/$appname" != "$0" -a -x "$full_appname/$appname" ]; then
relative_path="$appname"
else
# Search for a binary for this machine but a different library combo
if [ -d $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS ]; then
tmp_path=`pwd`
if [ -d "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS" ]; then
tmp_path="`pwd`"
cd "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS";
found=no
for lib_combo in * ; do
@ -224,26 +224,26 @@ else
fi
if [ $show_relative_path = 1 ]; then
echo $relative_path
echo "$relative_path"
exit 0
fi
if [ $show_full_path = 1 ]; then
echo $full_appname/$relative_path
echo "$full_appname/$relative_path"
exit 0
fi
if [ "$LIBRARY_COMBO" = nx-nx-nx -a $GNUSTEP_HOST_OS = nextstep4 ]; then
if [ "$LIBRARY_COMBO" = nx-nx-nx -a "$GNUSTEP_HOST_OS" = nextstep4 ]; then
if [ -f "$full_appname/library_paths.openapp" ]; then
additional_library_paths="`cat $full_appname/library_paths.openapp`"
fi
else
if [ -f "$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/library_paths.openapp" ]; then
additional_library_paths="`cat $full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/library_paths.openapp`"
additional_library_paths="`cat \"$full_appname/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/library_paths.openapp\"`"
fi
fi
# Load up LD_LIBRARY_PATH
. $GNUSTEP_SYSTEM_ROOT/@MAKEFILES_SUFFIX@/ld_lib_path.sh
. "$GNUSTEP_SYSTEM_ROOT/@MAKEFILES_SUFFIX@/ld_lib_path.sh"
exec $full_appname/$relative_path "$@"
exec "$full_appname/$relative_path" "$@"

View file

@ -66,7 +66,7 @@ case "$1" in
esac
# Remove leading slashes at the end of the application name
app=`echo $app | sed 's%/*$%%'`
app="`echo \"$app\" | sed 's%/*$%%'`"
# Now build the list of directory names we look for. If the user has
# given us a full application directory name (for example, Gorm.app)
@ -97,7 +97,7 @@ case "$app" in
for appdir in $app_list; do
#echo "$appdir"
if [ -d "$appdir" ]; then
full_appname=`(cd $appdir; pwd)`
full_appname="`(cd \"$appdir\"; pwd)`"
break
fi
done;;
@ -119,7 +119,7 @@ case "$app" in
if [ "$d" != "$dir/Applications/"'*'"/$appdir" ]; then
#echo " $d"
if [ -d "$d" ]; then
full_appname=`(cd "$d"; pwd)`
full_appname="`(cd \"$d\"; pwd)`"
break 3
fi
fi
@ -127,13 +127,13 @@ case "$app" in
# Now, in $dir/Applications/$appdir
#echo "$dir/Applications/$appdir"
if [ -d "$dir/Applications/$appdir" ]; then
full_appname=`(cd $dir/Applications/$appdir; pwd)`
full_appname="`(cd \"$dir/Applications/$appdir\"; pwd)`"
break 2
fi
# Finally, in $dir/$appdir
#echo "$dir/$appdir"
if [ -d "$dir/$appdir" ]; then
full_appname=`(cd $dir/$appdir; pwd)`
full_appname="`(cd \"$dir/$appdir\"; pwd)`"
break 2
fi
done
@ -152,9 +152,9 @@ fi
# get base app name
if [ -z "$appname" ]; then
appname=`echo $app | sed 's/\.[a-z]*$//'`
appname="`echo \"$app\" | sed 's/\.[a-z]*$//'`"
fi
appname=`basename $appname`
appname="`basename \"$appname\"`"
if [ -n "$GNUSTEP_FLATTENED" ]; then
@ -180,4 +180,3 @@ if [ -n "$only_find" ]; then
fi
exec "$full_appname/$appname" "$@"

View file

@ -32,8 +32,8 @@ if [ -z "$GNUSTEP_PATHLIST" ]; then
fi
if [ -z "$1" ]; then
echo usage: `basename $0` [--library-combo=...] tool [arguments...]
echo `basename $0` --help for help
echo usage: `basename "$0"` [--library-combo=...] tool [arguments...]
echo `basename "$0"` --help for help
exit 1
fi
@ -44,17 +44,17 @@ fi
# traps the parameters
while true
do
case $1 in
case "$1" in
--library-combo=*)
tmp_root="$GNUSTEP_SYSTEM_ROOT"
. "$tmp_root/@MAKEFILES_SUFFIX@/GNUstep-reset.sh"
LIBRARY_COMBO=`echo $1 | sed 's/--library-combo=//'`
LIBRARY_COMBO=`echo "$1" | sed 's/--library-combo=//'`
. "$tmp_root/@MAKEFILES_SUFFIX@/GNUstep.sh"
echo "Switched to library combo $LIBRARY_COMBO"
shift
;;
--help)
echo usage: `basename $0` [--library-combo=...] tool [arguments...]
echo usage: `basename "$0"` [--library-combo=...] tool [arguments...]
echo
echo tool is the complete or relative name of the tool executable
echo without any extension, like defaults
@ -67,21 +67,21 @@ do
esac
done
tool=$1;
tool="$1";
shift;
if [ -n "$EXEEXT" ]; then
tool=$tool$EXEEXT
tool="$tool$EXEEXT"
fi
case $tool in
case "$tool" in
/*) # An absolute path.
full_toolname=$tool;;
full_toolname="$tool";;
*/*) # A relative path
tool_dir=`dirname $tool`;
tool_dir=`(cd $tool_dir; pwd)`;
tool_name=`basename $tool`;
full_toolname=${tool_dir}/${tool_name};;
tool_dir="`dirname \"$tool\"`";
tool_dir="`(cd \"$tool_dir\"; pwd)`";
tool_name="`basename \"$tool\"`";
full_toolname="${tool_dir}/${tool_name}";;
*) # A path that should be searched into GNUstep tool paths
# Search for a local tool
@ -100,7 +100,7 @@ case $tool in
for dir in . obj Tools Tools/obj; do
# echo "$dir/$tool";
if [ -x "$dir/$tool" ]; then
full_toolname=$dir/$tool
full_toolname="$dir/$tool"
# echo "Found: $dir/$tool";
break;
fi
@ -122,29 +122,29 @@ case $tool in
# (For flattened systems we skip the first two options.
#
if [ -n "$GNUSTEP_PATHLIST" ]; then
SPATH=$GNUSTEP_PATHLIST
SPATH="$GNUSTEP_PATHLIST"
IFS=:
for dir in $SPATH; do
tmpdir=$dir/Tools
tmpdir="$dir/Tools"
if [ -z "$GNUSTEP_FLATTENED" ]; then
tmpgnudir=$dir/Tools/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS
tmplibdir=$tmpgnudir/$LIBRARY_COMBO
tmpgnudir="$dir/Tools/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS"
tmplibdir="$tmpgnudir/$LIBRARY_COMBO"
# echo "$tmplibdir/$tool";
if [ -x "$tmplibdir/$tool" ]; then
# echo "Found: $tmplibdir/$tool";
full_toolname=$tmplibdir/$tool
full_toolname="$tmplibdir/$tool"
break;
fi
if [ -x "$tmpgnudir/$tool" ]; then
# echo "Found: $tmpgnudir/$tool";
full_toolname=$tmpgnudir/$tool
full_toolname="$tmpgnudir/$tool"
break;
fi
fi
# echo "$tmpdir/$tool";
if [ -x "$tmpdir/$tool" ]; then
# echo "Found: $tmpdir/$tool";
full_toolname=$tmpdir/$tool
full_toolname="$tmpdir/$tool"
break;
fi
done