autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix quoting in autoconf --help=recursive


From: Paul Eggert
Subject: Re: Fix quoting in autoconf --help=recursive
Date: Thu, 19 Aug 2004 23:29:14 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Ralf Corsepius <address@hidden> writes:

> I am concentrating on VPATH builds where builddir contains white
> spaces while the sourcedir doesn't.
>
> E.g.:
> # pwd
> /home/testing/a b c
> # ../package/configure 

OK.  But I tried doing that on a Debian GNU/Linux host, and even with
your patch I found that "make check" failed miserably.

Your patch is clearly an improvement, so I installed it.  I also
installed the following patches, which fix some (but not all) of the
"make check" problems.  I got tired of debugging this and I figure
you're probably more motivated, so I hope you can look into it.

2004-08-19  Paul Eggert  <address@hidden>

        More fixes to support spaces in the name of the build directory.
        This isn't a complete fix but it's an improvement.

        * bin/autoconf.as (autom4te_options): New var.
        Use it instead of appending to AUTOM4TE, so that we can allow
        spaces in the build directory's absolute name.
        * bin/autoheader.in ($autoconf): Allow spaces in file names.
        * lib/autotest/general.m4 (AT_INIT, AT_CLEANUP, _AT_CHECK,
        AT_CHECK_NOESCAPE): Likewise.
        * tests/wrapper.as (testdir, AUTOM4TE_CFG, autom4te_perllibdir,
        main program): Likewise.

Index: bin/autoconf.as
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoconf.as,v
retrieving revision 1.9
diff -p -u -r1.9 autoconf.as
--- bin/autoconf.as     27 Jan 2004 19:02:51 -0000      1.9
+++ bin/autoconf.as     20 Aug 2004 06:15:44 -0000
@@ -1,6 +1,6 @@
 AS_INIT[]dnl                                            -*- shell-script -*-
 # autoconf -- create `configure' using m4 macros
-# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003
+# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2004
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -78,6 +78,7 @@ exit 1"
 
 # Variables.
 : ${AUTOM4TE='@bindir@/@autom4te-name@'}
+autom4te_options=
 dir=`AS_DIRNAME([$0])`
 outfile=
 verbose=:
@@ -96,7 +97,7 @@ while test $# -gt 0 ; do
 
     --verbose | -v )
        verbose=echo
-       AUTOM4TE="$AUTOM4TE $1"; shift ;;
+       autom4te_options="$autom4te_options $1"; shift ;;
 
     # Arguments passed as is to autom4te.
     --debug      | -d   | \
@@ -104,14 +105,14 @@ while test $# -gt 0 ; do
     --include=*  | -I?* | \
     --prepend-include=* | -B?* | \
     --warnings=* | -W?* )
-       AUTOM4TE="$AUTOM4TE $1"; shift ;;
+       autom4te_options="$autom4te_options '$1'"; shift ;;
 
     # Options with separated arg passed as is to autom4te.
     --include | -I | \
     --prepend-include | -B | \
     --warnings | -W )
        test $# = 1 && eval "$exit_missing_arg"
-       AUTOM4TE="$AUTOM4TE $option $2"
+       autom4te_options="$autom4te_options $option '$2'"
        shift 2 ;;
 
     --trace=* | -t?* )
@@ -123,7 +124,7 @@ while test $# -gt 0 ; do
        traces="$traces --trace='"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'"
        shift ;;
     --initialization | -i )
-       AUTOM4TE="$AUTOM4TE --melt"
+       autom4te_options="$autom4te_options --melt"
        shift;;
 
     --output=* | -o?* )
@@ -177,6 +178,8 @@ esac
 test -z "$outfile" && outfile=-
 
 # Run autom4te with expansion.
-eval set \$AUTOM4TE --language=autoconf --output=\$outfile "$traces" \$infile
+eval set x $autom4te_options \
+  --language=autoconf --output=\$outfile "$traces" \$infile
+shift
 $verbose "$me: running $*" >&2
-exec "$@"
+exec "$AUTOM4TE" "$@"
Index: bin/autoheader.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoheader.in,v
retrieving revision 1.139
diff -p -u -r1.139 autoheader.in
--- bin/autoheader.in   27 Jan 2004 19:02:51 -0000      1.139
+++ bin/autoheader.in   20 Aug 2004 06:15:44 -0000
@@ -157,9 +157,9 @@ END
   }
 
 # Set up autoconf.
-my $autoconf = "$autom4te --language=autoconf ";
-$autoconf .= join (' ', map { "--include=$_" } @include);
-$autoconf .= join (' ', map { "--prepend-include=$_" } @prepend_include);
+my $autoconf = "'$autom4te' --language=autoconf ";
+$autoconf .= join (' ', map { "--include='$_'" } @include);
+$autoconf .= join (' ', map { "--prepend-include='$_'" } @prepend_include);
 $autoconf .= ' --debug' if $debug;
 $autoconf .= ' --force' if $force;
 $autoconf .= ' --verbose' if $verbose;
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.156
diff -p -u -r1.156 general.m4
--- lib/autotest/general.m4     30 Jan 2004 14:29:18 -0000      1.156
+++ lib/autotest/general.m4     20 Aug 2004 06:15:45 -0000
@@ -254,7 +254,7 @@ do
        ;;
 
     --clean | -c )
-       rm -f -r $at_suite_dir $at_suite_log
+       rm -f -r "$at_suite_dir" "$at_suite_log"
        exit 0
        ;;
 
@@ -482,7 +482,7 @@ export PATH
 # 5 is the log file.  Not to be overwritten if `-d'.
 m4_define([AS_MESSAGE_LOG_FD], [5])
 $at_debug_p && at_suite_log=/dev/null
-exec AS_MESSAGE_LOG_FD>$at_suite_log
+exec AS_MESSAGE_LOG_FD>"$at_suite_log"
 
 # Banners and logs.
 AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.])
@@ -558,20 +558,20 @@ m4_divert_pop([PREPARE_TESTS])dnl
 m4_divert_push([TESTS])dnl
 
 # Create the master directory if it doesn't already exist.
-test -d $at_suite_dir ||
-  mkdir $at_suite_dir ||
-  AS_ERROR([cannot create $at_suite_dir])
+test -d "$at_suite_dir" ||
+  mkdir "$at_suite_dir" ||
+  AS_ERROR([cannot create '$at_suite_dir'])
 
 # Can we diff with `/dev/null'?  DU 5.0 refuses.
 if diff /dev/null /dev/null >/dev/null 2>&1; then
   at_devnull=/dev/null
 else
   at_devnull=$at_suite_dir/devnull
-  cp /dev/null $at_devnull
+  cp /dev/null "$at_devnull"
 fi
 
 # Use `diff -u' when possible.
-if diff -u $at_devnull $at_devnull >/dev/null 2>&1; then
+if diff -u "$at_devnull" "$at_devnull" >/dev/null 2>&1; then
   at_diff='diff -u'
 else
   at_diff=diff
@@ -581,7 +581,7 @@ fi
 for at_group in $at_groups
 do
   # Be sure to come back to the top test directory.
-  cd $at_suite_dir
+  cd "$at_suite_dir"
 
   case $at_group in
     banner-*)
@@ -608,7 +608,7 @@ do
       ;;
   esac
 
-  echo 0 > $at_status_file
+  echo 0 > "$at_status_file"
 
   # Clearly separate the test groups when verbose.
   test $at_group_count != 0 && $at_verbose
@@ -616,9 +616,9 @@ do
   # In verbose mode, append to the log file *and* show on
   # the standard output; in quiet mode only write to the log
   if test $at_verbose = echo; then
-    at_tee_pipe="tee -a $at_group_log"
+    at_tee_pipe='tee -a "$at_group_log"'
   else
-    at_tee_pipe="cat >> $at_group_log"
+    at_tee_pipe='cat >> "$at_group_log"'
   fi
 
   case $at_group in
@@ -634,22 +634,22 @@ m4_divert_push([TESTS_END])[]dnl
 
   # Be sure to come back to the suite directory, in particular
   # since below we might `rm' the group directory we are in currently.
-  cd $at_suite_dir
+  cd "$at_suite_dir"
 
   case $at_group in
     banner-*) ;;
     *)
-      if test ! -f $at_check_line_file; then
+      if test ! -f "$at_check_line_file"; then
        sed "s/^ */$as_me: warning: /" <<_ATEOF
        A failure happened in a test group before any test could be
        run. This means that test suite is improperly designed.  Please
        report this failure to <AT_PACKAGE_BUGREPORT>.
 _ATEOF
-       echo "$at_setup_line" >$at_check_line_file
+       echo "$at_setup_line" >"$at_check_line_file"
       fi
       at_group_count=`expr 1 + $at_group_count`
       $at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C"
-      echo $ECHO_N "$at_group. $at_setup_line: $ECHO_C" >> $at_group_log
+      echo $ECHO_N "$at_group. $at_setup_line: $ECHO_C" >> "$at_group_log"
       case $at_xfail:$at_status in
        yes:0)
            at_msg="UNEXPECTED PASS"
@@ -662,17 +662,17 @@ _ATEOF
            at_errexit=false
            ;;
        *:77)
-           at_msg="skipped (`cat $at_check_line_file`)"
+           at_msg='skipped ('`cat "$at_check_line_file"`')'
            at_skip_list="$at_skip_list $at_group"
            at_errexit=false
            ;;
        yes:*)
-           at_msg="expected failure (`cat $at_check_line_file`)"
+           at_msg='expected failure ('`cat $at_check_line_file`')'
            at_xfail_list="$at_xfail_list $at_group"
            at_errexit=false
            ;;
        no:*)
-           at_msg="FAILED (`cat $at_check_line_file`)"
+           at_msg='FAILED ('`cat $at_check_line_file`')'
            at_fail_list="$at_fail_list $at_group"
            at_errexit=$at_errexit_p
            ;;
@@ -685,11 +685,11 @@ _ATEOF
          # We're not including the group log, so the success message
          # is written in the global log separately.  But we also
          # write to the group log in case they're using -d.
-         if test -f $at_times_file; then
-           at_log_msg="$at_log_msg     (`sed 1d $at_times_file`)"
-           rm -f $at_times_file
+         if test -f "$at_times_file"; then
+           at_log_msg="$at_log_msg     ("`sed 1d "$at_times_file"`')'
+           rm -f "$at_times_file"
           fi
-         echo "$at_log_msg" >> $at_group_log
+         echo "$at_log_msg" >> "$at_group_log"
          echo "$at_log_msg" >&AS_MESSAGE_LOG_FD
 
          # Cleanup the group directory, unless the user wants the files.
@@ -699,14 +699,14 @@ _ATEOF
          # Upon failure, include the log into the testsuite's global
          # log.  The failure message is written in the group log.  It
          # is later included in the global log.
-         echo "$at_log_msg" >> $at_group_log
+         echo "$at_log_msg" >> "$at_group_log"
 
          # Upon failure, keep the group directory for autopsy, and
          # create the debugging script.
          {
            echo "#! /bin/sh"
            echo 'test "${ZSH_VERSION+set}" = set && alias -g 
'\''${1+"address@hidden"}'\''='\''"address@hidden"'\'''
-           echo "cd $at_dir"
+           echo "cd '$at_dir'"
            echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$[0]" \
                 '-v -d' "$at_debug_args" "$at_group" '${1+"address@hidden"}'
            echo 'exit 1'
@@ -720,7 +720,7 @@ _ATEOF
 done
 
 # Back to the top directory.
-cd $at_dir
+cd "$at_dir"
 
 # Compute the duration of the suite.
 at_stop_date=`date`
@@ -859,7 +859,7 @@ else
         # Create a fresh directory for the next test group, and enter.
         at_group_dir=$at_suite_dir/$at_group_normalized
         at_group_log=$at_group_dir/$as_me.log
-        cat $at_group_log
+        cat "$at_group_log"
         echo
       done
       echo
@@ -1090,9 +1090,9 @@ m4_divert_pop([TEST_SCRIPT])dnl Back to 
       $at_traceon
 m4_undivert([TEST_SCRIPT])dnl Insert the code here
       $at_traceoff
-      $at_times_p && times >$at_times_file
+      $at_times_p && times >"$at_times_file"
     ) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
-    at_status=`cat $at_status_file`
+    at_status=`cat "$at_status_file"`
     ;;
 
 m4_divert_pop([TESTS])dnl Back to KILL.
@@ -1123,7 +1123,7 @@ _ATEOF
 # Initialize an input data FILE with given CONTENTS, which should end with
 # an end of line.
 # This macro is not robust to active symbols in CONTENTS *on purpose*.
-# If you don't want CONTENT to be evaluated, quote it twice.
+# If you don't want CONTENTS to be evaluated, quote it twice.
 m4_define([AT_DATA],
 [cat >$1 <<'_ATEOF'
 $2[]_ATEOF
@@ -1220,32 +1220,32 @@ m4_define([AT_CHECK_NOESCAPE],
 m4_define([_AT_CHECK],
 [$at_traceoff
 echo "AT_LINE: AS_ESCAPE([$1])"
-echo AT_LINE >$at_check_line_file
-( $at_traceon; $1 ) >$at_stdout 2>$at_stder1
+echo AT_LINE >"$at_check_line_file"
+( $at_traceon; $1 ) >"$at_stdout" 2>"$at_stder1"
 at_status=$?
-grep '^ *+' $at_stder1 >&2
-grep -v '^ *+' $at_stder1 >$at_stderr
+grep '^ *+' "$at_stder1" >&2
+grep -v '^ *+' "$at_stder1" >"$at_stderr"
 at_failed=false
 dnl Check stderr.
 m4_case([$4],
-       stderr, [echo stderr:; tee stderr <$at_stderr],
-       ignore, [echo stderr:; cat $at_stderr],
-       experr, [$at_diff experr $at_stderr || at_failed=:],
-       [],     [$at_diff $at_devnull $at_stderr || at_failed=:],
-       [echo >>$at_stderr; echo "m4_ifval([$7],[AS_ESCAPE([$4])],[$4])" | 
$at_diff - $at_stderr || at_failed=:])
+       stderr, [echo stderr:; tee stderr <"$at_stderr"],
+       ignore, [echo stderr:; cat "$at_stderr"],
+       experr, [$at_diff experr "$at_stderr" || at_failed=:],
+       [],     [$at_diff "$at_devnull" "$at_stderr" || at_failed=:],
+       [echo >>"$at_stderr"; echo "m4_ifval([$7],[AS_ESCAPE([$4])],[$4])" | 
$at_diff - "$at_stderr" || at_failed=:])
 dnl Check stdout.
 m4_case([$3],
-       stdout, [echo stdout:; tee stdout <$at_stdout],
-       ignore, [echo stdout:; cat $at_stdout],
-       expout, [$at_diff expout $at_stdout || at_failed=:],
-       [],     [$at_diff $at_devnull $at_stdout || at_failed=:],
-       [echo >>$at_stdout; echo "m4_ifval([$7],[AS_ESCAPE([$3])],[$3])" | 
$at_diff - $at_stdout || at_failed=:])
+       stdout, [echo stdout:; tee stdout <"$at_stdout"],
+       ignore, [echo stdout:; cat "$at_stdout"],
+       expout, [$at_diff expout "$at_stdout" || at_failed=:],
+       [],     [$at_diff "$at_devnull" "$at_stdout" || at_failed=:],
+       [echo >>"$at_stdout"; echo "m4_ifval([$7],[AS_ESCAPE([$3])],[$3])" | 
$at_diff - "$at_stdout" || at_failed=:])
 dnl Check exit val.  Don't `skip' if we are precisely checking $? = 77.
 case $at_status in
 m4_case([$2],
   [77],
     [],
-    [   77) echo 77 > $at_status_file
+    [   77) echo 77 > "$at_status_file"
             exit 77;;
 ])dnl
 m4_case([$2],
@@ -1256,7 +1256,7 @@ m4_case([$2],
       at_failed=:;;])
 esac
 AS_IF($at_failed, [$5
-  echo 1 > $at_status_file
+  echo 1 > "$at_status_file"
   exit 1], [$6])
 $at_traceon
 ])# AT_CHECK_NOESCAPE
Index: tests/wrapper.as
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/wrapper.as,v
retrieving revision 1.2
diff -p -u -r1.2 wrapper.as
--- tests/wrapper.as    25 Sep 2003 09:30:35 -0000      1.2
+++ tests/wrapper.as    20 Aug 2004 06:15:45 -0000
@@ -1,6 +1,6 @@
 # wrapper.as -- running `$0' as if it were installed.   -*- shell-script -*-
 # @configure_input@
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,24 +19,24 @@
 
 AS_INIT[]dnl
 
address@hidden@/tests
+testdir='@abs_top_builddir@/tests'
 AUTOCONF=$testdir/autoconf
 AUTOHEADER=$testdir/autoheader
 AUTOM4TE=$testdir/autom4te
address@hidden@/lib/autom4te.cfg
address@hidden@/lib
+AUTOM4TE_CFG='@abs_top_builddir@/lib/autom4te.cfg'
+autom4te_perllibdir='@abs_top_srcdir@/lib'
 export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG autom4te_perllibdir
 
 case $as_me in
   ifnames)
      # Does not have lib files.
-     exec @abs_top_builddir@/bin/$as_me ${1+"$@"}
+     exec '@abs_top_builddir@'/bin/$as_me ${1+"$@"}
      ;;
   *)
      # We might need files from the build tree (frozen files), in
      # addition of src files.
-     exec @abs_top_builddir@/bin/$as_me \
-         -B @abs_top_builddir@/lib \
-         -B @abs_top_srcdir@/lib ${1+"$@"}
+     exec '@abs_top_builddir@'/bin/$as_me \
+         -B '@abs_top_builddir@'/lib \
+         -B '@abs_top_srcdir@/lib' ${1+"$@"}
 esac
 exit 1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]