While investigating autom4te cache locking on cygwin (that particular test was still failing because of a cygwin flock bug, which is hopefully now fixed), I noticed this bug:
$ echo AC_INIT | autom4te --language=autoconf -o configure $ printf 'AC_INIT\n#hi\n' | autom4te --language=autoconf -o configure $ grep '#hi' configure $ printf 'AC_INIT\n#hi\n' | autom4te --language=autoconf -o configure - $ grep '#hi' configure #hi Oops: without an explicit - argument, we assumed the cache was up-to-date. What's worse, running autom4te --verbose shows that we tried to compile aclocal.m4 as the target file, rather than reading from stdin - so even though we tried piping AC_INIT to autom4te, it was never expanded: $ echo AC_INIT | autom4te --language=autoconf --verbose -t AC_INIT 2>&1 | tail -c500 ST_NOTMAKE --trace=_LT_AC_TAGCONFIG --trace=_m4_warn --trace=include --trace=m4_include --trace=m4_pattern_allow --trace=m4_pattern_forbid --trace=m4_sinclude --trace=sinclude --reload-state=/usr/local/share/autoconf/autoconf/autoconf.m4f --undefine=__m4_version__ aclocal.m4 > autom4te.cache/output.0t autom4te: formatting traces for `/cygdrive/c/windows/temp/am4tBNzVBD/warnings': _m4_warn autom4te: reading /cygdrive/c/windows/temp/am4tBNzVBD/warnings autom4te: formatting traces for `-': AC_INIT $ But my perl-fu is too weak. I know that parse_args() computes the list of input files, but that includes files specified from --language as well as what was on the command line. We need a way to either reject command lines that use --language but no explicit target file, or to use an implicit '-' as the target file if the only files encountered came from --language options. At any rate, here's the testsuite addition I'd like to use if someone can help me figure out how to make autom4te recognize the absence of command-line-specified files as a reason to use an implicit '-' (the alternative would be testing that the third attempt is outright rejected because it did not have an explicit '-'): diff --git a/ChangeLog b/ChangeLog index e1a6494..031b00d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-22 Eric Blake <e...@byu.net> + + Lack of input files implies stdin (and thus autom4te --force). + * tests/tools.at (autoconf: input from stdin): Test this. + 2009-07-16 Eric Blake <e...@byu.net> Don't hide leading space in autom4te --trace output. diff --git a/tests/tools.at b/tests/tools.at index 542e668..f8da501 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -512,6 +512,9 @@ AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -], AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -], 0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org ]) +AT_CHECK([echo 'AC_INIT(X, 3.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT], + 0, [stdin:1:AC_INIT:X:3.0:bug-autoconf@gnu.org +]) AT_CLEANUP I also wonder if this implies an m4 bug. The normal use of m4 frozen files is to break up processing of multiple files, so that the final files are more efficient after the first few. But 'm4 foo.m4 -' is different than 'm4 foo.m4': the former implies two files, while the latter implies one, so there is nothing to break up. But 'm4 -F foo.m4f foo.m4; m4 -R foo.m4f' is behaving like the former (and reading from stdin), not the latter (doing nothing after reloading foo.m4's state). Should I change m4 -R to issue a warning if no additional input file name is found? And I'm committing this to fix the rest of the testsuite to always be explicit (fortunately, I only found one culprit, which happened to be the test that I mentioned at the start of this email that was tripping a cygwin bug). -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net
From 25853e5836109cf5a5113372ed578a0bb2950886 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Wed, 22 Jul 2009 06:50:14 -0600 Subject: [PATCH] Fix test of autom4te from stdin. * tests/tools.at (autom4te cache locking): Make stdin request explicit, so that --force is properly used. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 6 ++++++ tests/tools.at | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1a6494..4b9fb5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-07-22 Eric Blake <e...@byu.net> + + Fix test of autom4te from stdin. + * tests/tools.at (autom4te cache locking): Make stdin request + explicit, so that --force is properly used. + 2009-07-16 Eric Blake <e...@byu.net> Don't hide leading space in autom4te --trace output. diff --git a/tests/tools.at b/tests/tools.at index 542e668..529eb93 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -1034,8 +1034,8 @@ AT_SETUP([autom4te cache locking]) # Cannot use AT_CHECK here, autotest internals could be messed up. (echo AC_INIT; sleep 2; echo) \ - | (autom4te --language=autoconf -o configure; echo $? >&2 ) 2>errlog & -AT_CHECK([echo AC_INIT | autom4te --language=autoconf -o configure]) + | (autom4te --language=autoconf -o configure -; echo $? >&2 ) 2>errlog & +AT_CHECK([echo AC_INIT | autom4te --language=autoconf -o configure -]) wait # Ignore additional output from shell verbose or xtrace mode. -- 1.6.3.3.334.g916e1
signature.asc
Description: OpenPGP digital signature