* Ralf Wildenhues wrote on Sun, Feb 28, 2010 at 02:12:00PM CET: > I can reproduce these two failures on FreeBSD 6.4 (i386): > > > 35. tools.at:1174: testing ... > > ../../tests/tools.at:1191: : > sub/some-file && exit 77 > > stderr: > > /home/users/wilx/tmp/autoconf-2.65/objdir/tests/testsuite.dir/at-groups/35/test-source: > > cannot create sub/some-file: Permission denied > > stdout: > > ../../tests/tools.at:1191: exit code was 2, expected 1 > > 35. tools.at:1174: 35. autom4te cache creation (tools.at:1174): FAILED > > (tools.at:1191) > > > 239. c.at:57: testing ...
> > checking whether the C compiler works... no > > ../../tests/c.at:66: exit code was 1, expected 77 > > The second is us failing to adhere to '(autoconf.info)Shell Functions': > Likewise, the state of `$?' is not reliable when entering a shell > function. > > in AS_ERROR. The first seems to be a genuine shell error difference > (from glancing at SUSv3 I can only gather that a failed redirection > should result in an exit status > 0, but no further specification). > > I'm assuming the rest of the failures, which happen because no Fortran > compiler is installed, are due to the same issue as 239. I'm testing these two patches right now. I didn't see an easy way to keep as_fn_error API-compatible in the presence of trailing optional arguments, so aren't we glad we didn't publish that function. Still feel a bit uneasy about the first patch, as we don't cover AS_ERROR fully in the testsuite (e.g., the two-argument version). So, close review is appreciated. Thanks. (Sending them with format-patch in case you want to go ahead and apply them, Eric.) The second patch needs a subshell because sh just errors out right away upon failed redirection, which is actually correct as ':' is a special built-in utility. I'm seeing spurious testsuite failures when I pass '-v -d -x NNN' as TESTSUITEFLAGS, NNN being numbers, on FreeBSD. Haven't investigated further yet. Cheers, Ralf
>From 97932886547c39d94e75a01b55885c7dc15d6a2d Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues <[email protected]> Date: Sun, 28 Feb 2010 14:35:31 +0100 Subject: [PATCH 1/4] Fix AS_ERROR for FreeBSD sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): Rewrite as_fn_error to take additional first argument STATUS instead of transporting $? across shell function entry, which does not work with FreeBSD sh. Shift all other arguments by one, adjust. (AS_ERROR): Pass EXIT-STATUS, defaulting to $?, to as_fn_error. * THANKS: Update. Report by Václav Haisman. Signed-off-by: Ralf Wildenhues <[email protected]> --- ChangeLog | 11 +++++++++++ THANKS | 1 + lib/m4sugar/m4sh.m4 | 21 ++++++++++----------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98e0b31..a3ee4a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-02-28 Ralf Wildenhues <[email protected]> + + Fix AS_ERROR for FreeBSD sh. + * lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): Rewrite as_fn_error + to take additional first argument STATUS instead of transporting + $? across shell function entry, which does not work with FreeBSD + sh. Shift all other arguments by one, adjust. + (AS_ERROR): Pass EXIT-STATUS, defaulting to $?, to as_fn_error. + * THANKS: Update. + Report by Václav Haisman. + 2010-02-26 Eric Blake <[email protected]> Optimize AC_REPLACE_FUNCS. diff --git a/THANKS b/THANKS index 16dd8a3..ffa56de 100644 --- a/THANKS +++ b/THANKS @@ -388,6 +388,7 @@ Tomohiro Suzuki ? Tony Leneis [email protected] Toshio Kuratomi ? Uwe Seimet [email protected] +Václav Haisman [email protected] Vance Shipley [email protected] Viktor Dukhovni [email protected] Ville Karaila [email protected] diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 8160b3d..bfa6b44 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -816,22 +816,22 @@ m4_define([AS_WARN], # otherwise, assume the entire script does not do logging. m4_define([_AS_ERROR_PREPARE], [AS_REQUIRE_SHELL_FN([as_fn_error], - [AS_FUNCTION_DESCRIBE([as_fn_error], [ERROR]m4_ifval(AS_MESSAGE_LOG_FD, + [AS_FUNCTION_DESCRIBE([as_fn_error], [STATUS ERROR]m4_ifval(AS_MESSAGE_LOG_FD, [[ [[LINENO LOG_FD]]]]), [Output "`basename @S|@0`: error: ERROR" to stderr.] m4_ifval(AS_MESSAGE_LOG_FD, [[If LINENO and LOG_FD are provided, also output the error to LOG_FD, referencing LINENO.]]) - [Then exit the script with status $?, using 1 if that was 0.])], -[ as_status=$?; test $as_status -eq 0 && as_status=1 + [Then exit the script with STATUS, using 1 if that was 0.])], +[ as_status=$[1]; test $as_status -eq 0 && as_status=1 m4_ifval(AS_MESSAGE_LOG_FD, -[m4_pushdef([AS_MESSAGE_LOG_FD], [$[3]])dnl - if test "$[3]"; then - AS_LINENO_PUSH([$[2]]) - _AS_ECHO_LOG([error: $[1]]) +[m4_pushdef([AS_MESSAGE_LOG_FD], [$[4]])dnl + if test "$[4]"; then + AS_LINENO_PUSH([$[3]]) + _AS_ECHO_LOG([error: $[2]]) fi m4_define([AS_MESSAGE_LOG_FD])], [m4_pushdef([AS_MESSAGE_LOG_FD])])dnl - AS_MESSAGE([error: $[1]], [2]) + AS_MESSAGE([error: $[2]], [2]) _m4_popdef([AS_MESSAGE_LOG_FD])dnl AS_EXIT([$as_status])])]) @@ -842,9 +842,8 @@ _m4_popdef([AS_MESSAGE_LOG_FD])dnl m4_defun_init([AS_ERROR], [m4_append_uniq([_AS_CLEANUP], [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])], -[m4_ifvaln([$2], [{ AS_SET_STATUS([$2])])]dnl -[as_fn_error "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD, - [ "$LINENO" AS_MESSAGE_LOG_FD])[]m4_ifval([$2], [; }])]) +[as_fn_error m4_default([$2], [$?]) "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD, + [ "$LINENO" AS_MESSAGE_LOG_FD])]) # AS_LINENO_PUSH([LINENO]) -- 1.7.0.rc1.161.g90487
>From c7e2a7efa29a26717e668b40b1f4a95602fe73ff Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues <[email protected]> Date: Sun, 28 Feb 2010 06:36:08 +0100 Subject: [PATCH 2/4] Fix `autom4te cache creation' testsuite failure on FreeBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tests/tools.at (autom4te cache creation): Normalize exit status of failed redirection to 1, may be 2 with FreeBSD sh. Report by Václav Haisman. Signed-off-by: Ralf Wildenhues <[email protected]> --- ChangeLog | 5 +++++ tests/tools.at | 3 ++- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3ee4a5..bf091b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-02-28 Ralf Wildenhues <[email protected]> + Fix `autom4te cache creation' testsuite failure on FreeBSD. + * tests/tools.at (autom4te cache creation): Normalize exit + status of failed redirection to 1, may be 2 with FreeBSD sh. + Report by Václav Haisman. + Fix AS_ERROR for FreeBSD sh. * lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): Rewrite as_fn_error to take additional first argument STATUS instead of transporting diff --git a/tests/tools.at b/tests/tools.at index d8ac0dc..f3adb11 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -1230,7 +1230,8 @@ end-language: "Autoconf-without-aclocal-m4" ]]) # Do not try this when we are root or on systems without permissions. -AT_CHECK([: > sub/some-file && exit 77], 1, [ignore], [ignore]) +# A failed redirection may cause a status of 2 with FreeBSD sh. +AT_CHECK([(: > sub/some-file) || exit 1 && exit 77], 1, [ignore], [ignore]) # Failure to create cache directory. AT_CHECK_AUTOCONF([], [1], [ignore], [stderr]) -- 1.7.0.rc1.161.g90487
