Hi!

Ping.


On Tue, 3 Jun 2014 11:57:44 +0200, I wrote:
> Ping.
> 
> 
> On Thu, 22 May 2014 12:58:05 +0200, I wrote:
> > Ping.
> > 
> > 
> > On Fri, 14 Mar 2014 12:22:29 +0100, I wrote:
> > >     $ ../configure --enable-foo='--enable-a=1 --enable-b=2 --enable-c=3'
> > >     [...]
> > >     $ make configure-zlib
> > >     config.status: creating Makefile
> > >     config.status: executing default-1 commands
> > >     ../../zlib/../config-ml.in: eval: line 142: unexpected EOF while 
> > > looking for matching `''
> > >     ../../zlib/../config-ml.in: eval: line 143: syntax error: unexpected 
> > > end of file
> > >     make: *** [configure-zlib] Error 1
> > > 
> > >        140          case $enableopt in
> > >        141          enable_shared | enable_static) ;;
> > >        142          *) eval $enableopt="$optarg" ;;
> > >        143          esac
> > >        144          ;;
> > > 
> > >     $ grep ac_configure_args < zlib/config.status
> > >     ac_configure_args="  '--cache-file=./config.cache' 
> > > '--enable-foo=--enable-a=1 --enable-b=2 --enable-c=3' 
> > > '--enable-languages=c,c++,fortran,java,lto,objc' 
> > > '--program-transform-name=s,y,y,' '--disable-option-checking' 
> > > '--build=x86_64-unknown-linux-gnu' '--host=x86_64-unknown-linux-gnu' 
> > > '--target=x86_64-unknown-linux-gnu' '--srcdir=../../zlib' 
> > > 'build_alias=x86_64-unknown-linux-gnu' 
> > > 'host_alias=x86_64-unknown-linux-gnu' 
> > > 'target_alias=x86_64-unknown-linux-gnu'"
> > > 
> > > These are quoted correctly; the error happens because the
> > > ac_configure_args parsing logic in config-ml.in will parse this as:
> > > 
> > >  1. '--enable-foo=--enable-a=1
> > >  2. --enable-b=2
> > >  3. --enable-c=3'
> > > 
> > > Below I'm proposing a patch using a shell function and eval to properly
> > > handle such configure arguments.  Instead of a shell function, we could
> > > also use:
> > > 
> > >     eval set x "${ac_configure_args}" && shift
> > >     for option
> > >     do
> > >       [...]
> > >     done
> > > 
> > > ..., as done in top-level configure.ac for baseargs etc., but as the
> > > config-ml.in script is sourced in different contexts, it is not obvious
> > > to me that we're permitted to overwrite the shell's positional parameters
> > > here.
> > > 
> > > OK for trunk?  (Will properly indent scan_arguments before commit.)
> > > 
> > > commit bc6f99e9840994309eaf4e88679c3ba50d5e4918
> > > Author: Thomas Schwinge <tho...@codesourcery.com>
> > > Date:   Thu Mar 13 19:54:58 2014 +0100
> > > 
> > >           * config-ml.in: Robustify ac_configure_args parsing.
> > > 
> > > diff --git config-ml.in config-ml.in
> > > index 1198346..0cd7db3 100644
> > > --- config-ml.in
> > > +++ config-ml.in
> > > @@ -105,10 +105,13 @@ ml_realsrcdir=${srcdir}
> > >  
> > >  # Scan all the arguments and set all the ones we need.
> > >  
> > > +scan_arguments ()
> > > +{
> > >  ml_verbose=--verbose
> > > -for option in ${ac_configure_args}
> > > +for option
> > >  do
> > > -  # strip single quotes surrounding individual options
> > > +  # Strip single quotes surrounding individual options, that is, remove 
> > > one
> > > +  # level of shell quoting for these.
> > >    case $option in
> > >    \'*\') eval option=$option ;;
> > >    esac
> > > @@ -139,7 +142,7 @@ do
> > >   # Don't undo its work.
> > >   case $enableopt in
> > >   enable_shared | enable_static) ;;
> > > - *) eval $enableopt="$optarg" ;;
> > > + *) eval $enableopt='$optarg' ;;
> > >   esac
> > >   ;;
> > >    --norecursion | --no-recursion)
> > > @@ -157,7 +160,7 @@ do
> > >   *)      optarg=yes ;;
> > >   esac
> > >   withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
> > > - eval $withopt="$optarg"
> > > + eval $withopt='$optarg'
> > >   ;;
> > >    --without-*)
> > >   withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
> > > @@ -165,6 +168,11 @@ do
> > >   ;;
> > >    esac
> > >  done
> > > +}
> > > +# Use eval to properly handle configure arguments such as
> > > +# --enable-foo='--enable-a=1 --enable-b=2 --enable-c=3'.
> > > +eval scan_arguments "${ac_configure_args}"
> > > +unset scan_arguments
> > >  
> > >  # Only do this if --enable-multilib.
> > >  if [ "${enable_multilib}" = yes ]; then
> > > @@ -860,7 +868,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" 
> > > ]; then
> > >  
> > >      if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
> > >   --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
> > > - ${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then
> > > + "${ac_configure_args}" ${ml_config_env} ${ml_srcdiroption} ; then
> > >        true
> > >      else
> > >        exit 1


Grüße,
 Thomas

Attachment: pgpJ_V20GwP9J.pgp
Description: PGP signature

Reply via email to