>From cca288d94e1d1992dd157e43c5891213c87b46be Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 3 Mar 2012 10:44:25 +0100 Subject: [PATCH 1/7] configure: don't infloop when re-executing with $CONFIG_SHELL It turns out our guard against infinite recursion wasn't good enough when shells without $LINENO support were involved, since the creation-and-sourcing of configure.lineno broke the guard's expectations. Reports by Tim Rice and Paul Eggert. * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Export '_as_can_reexec' to "no" before sourcing the just-created configure.lineno. --- lib/m4sugar/m4sh.m4 | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index be013aa..f05346b 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -1199,6 +1199,10 @@ dnl Eggert wrote the scripts with optimization help from Paolo Bonzini). chmod +x "$as_me.lineno"] || AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell]) + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). -- 1.7.6.5 >From 7d55ba7fd930ad1f56946ba9d7e9ef573caf93f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 Mar 2012 18:42:21 -0800 Subject: [PATCH 2/7] tests: port AS_EXECUTABLE_P test to Solaris 8 /bin/sh * tests/m4sh.at (AS@&address@hidden): Treat any nonzero exit status as failure. This is needed for Solaris 8 /bin/sh, where executing a nonexecutable file causes the shell to say the file had exit status 1. --- tests/m4sh.at | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tests/m4sh.at b/tests/m4sh.at index 38667e4..a24915b 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -579,7 +579,7 @@ st1=$? (./foo.sh) >/dev/null 2>&1 st2=$? case $st1:$st2 in - 1:126 | 0:0 ) echo 2 ;; + *[[1-9]]*:*[[1-9]]* | 0:0 ) echo 2 ;; *) echo "fail ($st1:$st2)" ;; esac # Now things better be executable -- 1.7.6.5 >From bb454862bb167fb9aeb5222edd5ec1ab974754e1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 Mar 2012 18:47:36 -0800 Subject: [PATCH 3/7] tests: fix "#/bin/sh" typo * tests/m4sh.at (AS@&address@hidden): "#!/bin/sh", not "#/bin/sh". Typo reported by Tim Rice in: http://lists.gnu.org/archive/html/autoconf-patches/2012-03/msg00009.html --- tests/m4sh.at | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tests/m4sh.at b/tests/m4sh.at index a24915b..9456899 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -569,7 +569,7 @@ else echo 1 fi cat > foo.sh <<\EOF || AS_EXIT([1]) -#/bin/sh +#!/bin/sh exit 0 EOF # File systems like FAT tend to fake executable permissions on all files. -- 1.7.6.5 >From 49b68f063e33f22814de0ce01f4b7119d5c776c3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 Mar 2012 21:28:01 -0800 Subject: [PATCH 4/7] tests: port AS_TR_SH and AS_TR_CPP test to Solaris 8 wc * tests/m4sh.at (AS@&address@hidden and AS@&address@hidden): Do not assume that "wc -l" outputs only digits; on Solaris 8 it also outputs blanks and POSIX allows this. --- tests/m4sh.at | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/m4sh.at b/tests/m4sh.at index 9456899..8e9d1fe 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -1559,9 +1559,10 @@ A_B_C_P__ dnl Check that of the last 6 macros, only 2 needed command substitution. dnl This test abuses our knowledge of m4sh internals a bit; oh well. -AT_CHECK([sed -n '/start here/,$ { +AT_CHECK([tab=' ' # a single ASCII tab character +sed -n '/start here/,$ { /`.*`/p -}' script | wc -l], [], [[2 +}' script | wc -l | sed "s/[[ $tab]]//g" ], [], [[2 ]]) AT_CLEANUP -- 1.7.6.5 >From 3b78f246db536275db653903a49725179f5945c2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 Mar 2012 21:35:29 -0800 Subject: [PATCH 5/7] fortran: clean up core files after AC_FC_CHECK_BOUNDS * lib/autoconf/fortran.m4 (AC_FC_CHECK_BOUNDS): Clean up core files, too. Needed for Sun Fortran 95 8.2 2005/10/13 on Solaris 8. --- lib/autoconf/fortran.m4 | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index afeb3ab..3803595 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -1599,7 +1599,8 @@ do [], [ac_cv_fc_check_bounds=$ac_flag; break])])])]) done -rm -f conftest$ac_exeext conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest$ac_exeext conftest.err conftest.$ac_objext conftest.$ac_ext \ + core *.core core.conftest.* FCFLAGS=$ac_fc_check_bounds_FCFLAGS_save ]) if test "x$ac_cv_fc_check_bounds" = xunknown; then -- 1.7.6.5 >From 6e7264cf45b61cf40e0cc91b63ae8365d4f2d1f1 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 4 Mar 2012 16:30:17 +0100 Subject: [PATCH 6/7] tests: fix spurious failure when CONFIG_SITE is set * tests/m4sh.at (Configure re-execs self with CONFIG_SHELL): Export $CONFIG_SITE to "/dev/null", to avoid spurious diffs in expected stdout/stderr. --- tests/m4sh.at | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/tests/m4sh.at b/tests/m4sh.at index 8e9d1fe..78fe967 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -120,7 +120,10 @@ exec sh "@S|@@" chmod a+x cfg-sh AT_CAPTURE_FILE([config.log]) -AT_CHECK([env CONFIG_SHELL=./cfg-sh ./configure], [0], [], []) +# Export CONFIG_SITE to /dev/null to avoid spurious diffs in expected +# stdout/stderr. +AT_CHECK([env CONFIG_SITE=/dev/null CONFIG_SHELL=./cfg-sh ./configure], + [0], [], []) # ./configure re-executed itself. AT_CHECK([test -f cfg-sh-has-run], [0]) # And did that not to cause extra execution of later commands. -- 1.7.6.5 >From 43814d248d030849c366e83e550f90a88596461d Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 4 Mar 2012 17:14:14 +0100 Subject: [PATCH 7/7] tests: fix spurious failure due to Solaris XPG4 sh bug On Solaris 10, the /usr/xpg4/bin/sh shell seems unable to execute a shell script named 'script': $ touch script $ /bin/sh script; echo status: $? # As expected. status: 0 $ /usr/xpg4/bin/sh script; echo status: $? # Weirdness follows. /usr/xpg4/bin/sh: script: cannot execute status: 1 This was causing a spurious testsuite failure for users which have /usr/xpg4/bin in $PATH before /bin and /usr/bin. Fix that. * tests/m4sh.at (Configure re-execs self with CONFIG_SHELL): Rename the m4sh-produced script to 'script2', to avoid the just-described issue. --- tests/m4sh.at | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/m4sh.at b/tests/m4sh.at index 78fe967..4e4da5d 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -49,6 +49,10 @@ echo foo > sentinel ]]) AT_CHECK_M4SH +# Calling the script simply 'script' could cause problems with +# Solaris /usr/xpg4/bin/sh in the invocation 'sh script' below. +mv -f script script2 + AT_DATA([fake-shell], [[#!/bin/sh echo 'Fake shell executed.' @@ -61,7 +65,7 @@ done ]]) chmod a+x fake-shell -AT_CHECK([CONFIG_SHELL=./fake-shell ./script 1 2 4 8], [0], +AT_CHECK([CONFIG_SHELL=./fake-shell ./script2 1 2 4 8], [0], [Fake shell executed. nargs = 4 :1: @@ -73,7 +77,7 @@ AT_CHECK([test ! -f sentinel], [0]) test ! -f sentinel || rm -f sentinel # Cleanup for next test. AT_CHECK( -[CONFIG_SHELL=`pwd`/fake-shell sh script a 'b c' ' d e '], +[CONFIG_SHELL=`pwd`/fake-shell sh script2 a 'b c' ' d e '], [0], [Fake shell executed. nargs = 3 @@ -85,7 +89,7 @@ AT_CHECK([test ! -f sentinel], [0]) test ! -f sentinel || rm -f sentinel # Cleanup for next test. AT_CHECK([(PATH=`pwd`:$PATH; export PATH; -CONFIG_SHELL=fake-shell script '' '&' '!;*' '<(address@hidden:@)>,' 'x +CONFIG_SHELL=fake-shell script2 '' '&' '!;*' '<(address@hidden:@)>,' 'x y z 1 2 3')], [0], [Fake shell executed. -- 1.7.6.5