diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-01-18 16:28:54 +0100 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2013-01-18 16:28:54 +0100 |
commit | 2c0fe206d94f1b2a8ee4d40e5b1841d003fd7319 (patch) | |
tree | 37edd8843776a7cd3892a2de7d4666906093c078 | |
parent | a787b9caa6b6970e48e3a2f512077446386fc838 (diff) | |
parent | f78b0f0b2741fcdd4e21151758a8a75ddaa8aa17 (diff) | |
download | automake-2c0fe206d94f1b2a8ee4d40e5b1841d003fd7319.tar.gz |
Merge branch 'rm-f-probe' into maint
* rm-f-probe:
init.m4: add probe to check "rm -f" without args work
-rw-r--r-- | PLANS/rm-f-without-args.txt | 8 | ||||
-rw-r--r-- | m4/init.m4 | 43 | ||||
-rw-r--r-- | t/list-of-tests.mk | 1 | ||||
-rwxr-xr-x | t/rm-f-probe.sh | 74 | ||||
-rwxr-xr-x | t/spy-rm.tap | 8 |
5 files changed, 125 insertions, 9 deletions
diff --git a/PLANS/rm-f-without-args.txt b/PLANS/rm-f-without-args.txt index 5d39e220d..5362f98e6 100644 --- a/PLANS/rm-f-without-args.txt +++ b/PLANS/rm-f-without-args.txt @@ -13,13 +13,13 @@ accordingly, to get rid of the awful idiom: See automake bug#10828. -For Automake 1.13.2 (or 1.13.3) -------------------------------- +For Automake 1.13.2 (DONE) +-------------------------- Add a temporary "probe check" in AM_INIT_AUTOMAKE that verifies that the no-args "rm -f" usage is supported on the system configure is -being run on; complain loudly (but not with a fatal error) if this is -not the case, and tell the user to report the situation to us. +being run on; complain loudly if this is not the case, and tell the +user to report the situation to us. For Automake 1.14 ----------------- diff --git a/m4/init.m4 b/m4/init.m4 index c5af65cce..ce64a6ccf 100644 --- a/m4/init.m4 +++ b/m4/init.m4 @@ -117,7 +117,48 @@ dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: <http://www.gnu.org/software/coreutils/>. + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 44f598ed2..0f5dbee01 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -953,6 +953,7 @@ t/remake-macrodir.sh \ t/remake-timing-bug-pr8365.sh \ t/reqd2.sh \ t/repeated-options.sh \ +t/rm-f-probe.sh \ t/rulepat.sh \ t/self-check-cc-no-c-o.sh \ t/self-check-configure-help.sh \ diff --git a/t/rm-f-probe.sh b/t/rm-f-probe.sh new file mode 100755 index 000000000..1cb220aa0 --- /dev/null +++ b/t/rm-f-probe.sh @@ -0,0 +1,74 @@ +#! /bin/sh +# Copyright (C) 2013 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 +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Verify our probe that checks that "rm -f" doesn't complain if called +# without file operands works as expected. See automake bug#10828. + +. test-init.sh + +echo AC_OUTPUT >> configure.ac +: > Makefile.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +mkdir bin +cat > bin/rm <<'END' +#!/bin/sh +set -e; set -u; +PATH=$original_PATH; export PATH +rm_opts= +while test $# -gt 0; do + case $1 in + -*) rm_opts="$rm_opts $1";; + *) break;; + esac + shift +done +if test $# -eq 0; then + echo "Oops, fake rm called without arguments" >&2 + exit 1 +else + exec rm $rm_opts "$@" +fi +END +chmod a+x bin/rm + +original_PATH=$PATH +PATH=$(pwd)/bin$PATH_SEPARATOR$PATH +export PATH original_PATH + +rm -f && exit 99 # Sanity check. + +./configure 2>stderr && { cat stderr >&2; exit 1; } +cat stderr >&2 + +grep "'rm' program.* unable to run without file operands" stderr +$FGREP "tell bug-automake@gnu.org about your system" stderr +$FGREP "install GNU coreutils" stderr +$EGREP "(^| |')ACCEPT_INFERIOR_RM_PROGRAM($| |')" stderr + +ACCEPT_INFERIOR_RM_PROGRAM=yes; export ACCEPT_INFERIOR_RM_PROGRAM + +./configure +$MAKE +$MAKE distcheck + +# For the sake of our exit trap. +PATH=$original_PATH; export PATH + +: diff --git a/t/spy-rm.tap b/t/spy-rm.tap index 29840abf4..3b8dd2d10 100755 --- a/t/spy-rm.tap +++ b/t/spy-rm.tap @@ -19,10 +19,10 @@ # to hold on all non-museum systems, and will soon be mandated # by POSIX as well) in future version of automake, to simplify # automake-provided cleanup rules. -# References: -# <http://lists.gnu.org/archive/html/bug-autoconf/2012-02/msg00002.html> -# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10819> -# <http://austingroupbugs.net/view.php?id=542> +# See automake bug#10828. +# Other references: +# <http://lists.gnu.org/archive/html/bug-autoconf/2012-02/msg00002.html> +# <http://austingroupbugs.net/view.php?id=542> am_create_testdir=empty . test-init.sh |