[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Argument quoting problem when processing config_subdirs
From: |
Tim Van Holder |
Subject: |
Argument quoting problem when processing config_subdirs |
Date: |
Sat, 6 Jan 2001 20:54:04 +0100 |
When configure runs configures in subdirs (in _AC_OUTPUT_SUBDIRS),
it makes two big (related) mistakes:
1) When dropping --srcdir and --cache-file from the list of
arguments, it doesn't check for quoted versions (i.e.
'--srcdir=path_with_meta_chars_or_some_such_nonsense')
2) When adding --srcdir and --cache-file, no attempt is made to
quote them.
This breaks configure if srcdir contains metachars.
I hacked around this for my DJGPP patches, but since this is not
just a DOS compatibility issue (although DOS is probably most
affected because of the use of a backslash as dirsep), I thought
I'd report it.
A diff with my hack is appended, but there's probably better ways
of handling this.
--- \Tmp\Source\autoconf-2.49b.gnu\acgeneral.m4 Wed Dec 6 14:44:12 2000
+++ \Tmp\Source\autoconf-2.49b\acgeneral.m4 Sat Jan 6 20:37:14 2001
@@ -4597,8 +4681,10 @@
if test "$no_recursion" != yes; then
# Remove --cache-file and --srcdir arguments so they do not pile up.
+dnl Don't forget we might have quoted these!
ac_sub_configure_args=
ac_prev=
+ ac_sep=
for ac_arg in $ac_configure_args; do
if test -n "$ac_prev"; then
ac_prev=
@@ -4612,13 +4698,21 @@
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
| --c=*)
;;
+ '-cache-file=*' | '--cache-file=*' | '--cache-fil=*' | '--cache-fi=*' \
+ | '--cache-f=*' | '--cache-=*' | '--cache=*' | '--cach=*' | '--cac=*' \
+ | '--ca=*' | '--c=*')
+ ;;
--config-cache | -C)
;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ '-srcdir=*' | '--srcdir=*' | '--srcdi=*' | '--srcd=*' | '--src=*'
+ | '--sr=*')
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args$ac_sep$ac_arg"
+ ac_sep=" ";;
esac
done
@@ -4686,9 +4780,28 @@
esac
])dnl
- AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args
--cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir])
+ dnl Since we're fabricating the --srcdir option, quote it like
+ dnl like we normally would.
+ case $ac_sub_srcdir in
+[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
+ ac_sub_srcdir=`echo "$ac_sub_srcdir" | sed "s/'/'\\\\\\\\''/g"`
+ ac_sub_srcdir_opt="'--srcdir=$ac_sub_srcdir'" ;;
+ *) ac_sub_srcdir_opt="--srcdir=$ac_sub_srcdir" ;;
+ esac
+ ac_sub_configure_args="$ac_sub_configure_args$ac_sep$ac_sub_srcdir_opt"
+
+ dnl Same goes for --cache-file
+ case $ac_cache_file in
+[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
+ ac_cache_file=`echo "$ac_cache_file" | sed "s/'/'\\\\\\\\''/g"`
+ ac_cache_file_opt="'--cache-file=$ac_cache_file'" ;;
+ *) ac_cache_file_opt="--cache-file=$ac_cache_file" ;;
+ esac
+ ac_sub_configure_args="$ac_sub_configure_args$ac_sep$ac_cache_file_opt"
+
+ AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args])
# The eval makes quoting arguments work.
- if eval $ac_sub_configure $ac_sub_configure_args
--cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ if eval $ac_sub_configure $ac_sub_configure_args
then :
else
AC_MSG_ERROR([$ac_sub_configure failed for $ac_subdir])
- Argument quoting problem when processing config_subdirs,
Tim Van Holder <=
- RE: Argument quoting problem when processing config_subdirs, Tim Van Holder, 2001/01/06
- RE: Argument quoting problem when processing config_subdirs, Tim Van Holder, 2001/01/06
- RE: Argument quoting problem when processing config_subdirs, Tim Van Holder, 2001/01/06
- Re: Argument quoting problem when processing config_subdirs, Akim Demaille, 2001/01/11
- Re: Argument quoting problem when processing config_subdirs, Pavel Roskin, 2001/01/11
- RE: Argument quoting problem when processing config_subdirs, Tim Van Holder, 2001/01/11
- Re: Argument quoting problem when processing config_subdirs, Akim Demaille, 2001/01/15
- Re: Argument quoting problem when processing config_subdirs, Akim Demaille, 2001/01/15