Patchwork PR binutils/12110 spaces in source path

login
register
mail settings
Submitter Alan Modra
Date Oct. 12, 2010, 11:47 p.m.
Message ID <20101012234714.GX26553@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/67632/
State New
Headers show

Comments

Alan Modra - Oct. 12, 2010, 11:47 p.m.
Patch does as per the ChangeLog.  A fix to actually support spaces in
$srcdir is a bit more work.  I started down that path, fixing all the
shell expansions, but then hit the problem of VPATH and $srcdir in
make targets/dependencies.  Apparently it is possible to escape spaces
with a backslash for make, but I'm not motivated enough to do that..

Fiddling with AS_MESSAGE_LOG_FD below is necessary because
AC_MSG_ERROR at this point in configure.ac would normally echo to
config.log, but we're using m4_divert_text to put the test before the
first real use of $srcdir, before config.log output is opened.

OK to install?  Tested with gcc and binutils configure.

	PR binutils/12110
	* configure.ac: Error when source path contains spaces.
	* configure: Regenerate.
Ralf Wildenhues - Oct. 13, 2010, 5:13 a.m.
Hello Alan,

* Alan Modra wrote on Wed, Oct 13, 2010 at 01:47:14AM CEST:
> Patch does as per the ChangeLog.  A fix to actually support spaces in
> $srcdir is a bit more work.  I started down that path, fixing all the
> shell expansions, but then hit the problem of VPATH and $srcdir in
> make targets/dependencies.  Apparently it is possible to escape spaces
> with a backslash for make, but I'm not motivated enough to do that..

Supporting white space in $srcdir is impossible.  Posix 'make' doesn't
allow it.  Supporting white space in $abs_srcdir is theoretically
possible (in the sense that recent Autoconf and Automake have the
necessary measures in place, and 'make' will play along as long as you
make sure to never try to use absolute file names for things), but in
practice impossible due to *lots* of places in GCC that require absolute
file names; among others, the whole staging machinery relies on it.
Same with white space in $abs_builddir.

For white space in $abs_builddir and in $prefix, Libtool is also a
serious violator (and too much hassle to be fixed, sorry).

> Fiddling with AS_MESSAGE_LOG_FD below is necessary because
> AC_MSG_ERROR at this point in configure.ac would normally echo to
> config.log, but we're using m4_divert_text to put the test before the
> first real use of $srcdir, before config.log output is opened.

This uses undocumented details of Autoconf but otherwise seems right.

> OK to install?  Tested with gcc and binutils configure.

See nit below.  FWIW I cannot approve it.

Thanks,
Ralf

> 	PR binutils/12110
> 	* configure.ac: Error when source path contains spaces.
> 	* configure: Regenerate.

> --- configure.ac	7 Oct 2010 20:50:01 -0000	1.109
> +++ configure.ac	12 Oct 2010 08:04:55 -0000
> @@ -221,7 +221,14 @@ target_configdirs=`echo ${target_librari
>  build_configdirs=`echo ${build_libs} ${build_tools}`
>  
>  m4_divert_text([PARSE_ARGS],
> -[ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
> +[case $srcdir in
> +  *" "*)
> +m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
> +    AC_MSG_ERROR([path to source, $srcdir, contains spaces])
> +_m4_popdef([AS_MESSAGE_LOG_FD])dnl

Why not m4_popdef instead of _m4_popdef?

> +    ;;
> +esac
> +ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
>  ])
>  
>  ################################################################################
Alan Modra - Oct. 18, 2010, 2:26 p.m.
On Wed, Oct 13, 2010 at 07:13:29AM +0200, Ralf Wildenhues wrote:
> > +m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
> > +    AC_MSG_ERROR([path to source, $srcdir, contains spaces])
> > +_m4_popdef([AS_MESSAGE_LOG_FD])dnl
> 
> Why not m4_popdef instead of _m4_popdef?

Because I cut and pasted this from somewhere else that happened to use
_m4_popdef.  ;-)  Yes, m4_popdef works fine.
DJ Delorie - Nov. 1, 2010, 11:36 p.m.
> Because I cut and pasted this from somewhere else that happened to use
> _m4_popdef.  ;-)  Yes, m4_popdef works fine.

Ok with me.

Patch

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/configure.ac,v
retrieving revision 1.109
diff -u -p -r1.109 configure.ac
--- configure.ac	7 Oct 2010 20:50:01 -0000	1.109
+++ configure.ac	12 Oct 2010 08:04:55 -0000
@@ -221,7 +221,14 @@  target_configdirs=`echo ${target_librari
 build_configdirs=`echo ${build_libs} ${build_tools}`
 
 m4_divert_text([PARSE_ARGS],
-[ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
+[case $srcdir in
+  *" "*)
+m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
+    AC_MSG_ERROR([path to source, $srcdir, contains spaces])
+_m4_popdef([AS_MESSAGE_LOG_FD])dnl
+    ;;
+esac
+ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
 ])
 
 ################################################################################