automake-patches
[Top][All Lists]
Advanced

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

Re: bug#12554: Checking MAKEFLAGS with RECURSIVE_TARGETS


From: Stefano Lattarini
Subject: Re: bug#12554: Checking MAKEFLAGS with RECURSIVE_TARGETS
Date: Wed, 03 Oct 2012 10:17:45 +0200

Reference: <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12554>

Hi Michael, thanks for the report.

I can indeed confirm this is a bug.  For the moment, I have added a
test case exposing it (see patch below).  I hope to be able to fix
it for Automake 1.12.5.

Thanks,
  Stefano

---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

>From a8eac4978d3ba21da0e1ee3ce643788383997de0 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Tue, 2 Oct 2012 21:27:28 +0200
Subject: [PATCH] subdirs: don't return false positives for the '-k' option's
 presence

This change is related to automake bug#12554.

The current implementation of the code descending into $(SUBDIRS)
entries uses the following snippet to decide whether make is running
with the '-k' a.k.a. '--keep-going' option, and thus whether a failure
in a subdirectory should prevent the descent in the following ones:

    fail= failcom='exit 1'; \
    for f in x $$MAKEFLAGS; do \
      case $$f in \
        *=* | --[!k]*);; \
        *k*) failcom='fail=yes';; \
      esac; \
    done

It's clear that the second pattern in the 'case' construct can possibly
match false positives, for examples in these two cases:

    make check TESTS="x.test k.test"
    make -I /usr/local/kool-fragments

which are somewhat unusual, but not invalid.  So we need a more resilient
implementation, as we did for the detection of the '-n' flag.

But alas, such an implementation seems quite tricky to obtain in portable
make.  So for the moment we content ourselves with exposing the bug, with
the hope of being able to fix it at a later date.  If not in mainline
Automake, at least in Automake-NG.

* t/subdir-keep-going-pr12554.sh: New test.
* t/list-of-tests.mk (handwritten_TESTS, XFAIL_TESTS): Add it.
* THANKS: Update

Reported-by: Michael Daniels <address@hidden>
Signed-off-by: Stefano Lattarini <address@hidden>
---
 THANKS                         |  1 +
 t/list-of-tests.mk             |  2 ++
 t/subdir-keep-going-pr12554.sh | 58 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100755 t/subdir-keep-going-pr12554.sh

diff --git a/THANKS b/THANKS
index 88f539c..15a3d8e 100644
--- a/THANKS
+++ b/THANKS
@@ -252,6 +252,7 @@ Maxim Sinev                     address@hidden
 Maynard Johnson                 address@hidden
 Merijn de Jonge                 address@hidden
 Michael Brantley                address@hidden
+Michael Daniels                 address@hidden
 Michael Hofmann                 address@hidden
 Michael Ploujnikov              address@hidden
 Michel de Ruiter                address@hidden
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index b3ff6b2..1bfd056 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -41,6 +41,7 @@ t/pr8365-remake-timing.sh \
 t/lex-subobj-nodep.sh \
 t/remake-am-pr10111.sh \
 t/remake-m4-pr10111.sh \
+t/subdir-keep-going-pr12554.sh \
 t/tags-pr12372.sh \
 t/txinfo5.sh \
 $(perl_fake_XFAIL_TESTS)
@@ -1023,6 +1024,7 @@ t/subdir-with-slash.sh \
 t/subdir-subsub.sh \
 t/subdir10.sh \
 t/subdir-distclean.sh \
+t/subdir-keep-going-pr12554.sh \
 t/subdirbuiltsources.sh \
 t/subobj.sh \
 t/subobj2.sh \
diff --git a/t/subdir-keep-going-pr12554.sh b/t/subdir-keep-going-pr12554.sh
new file mode 100755
index 0000000..59bd7d0
--- /dev/null
+++ b/t/subdir-keep-going-pr12554.sh
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Check that the Automake-generated recursive rules are resilient against
+# false positives in deciding whether make is running with the '-k'
+# option, and thus whether a failure into one of the $(SUBDIRS) should
+# still prevent recursion in the following $(SUBDIRS) entries.  See
+# automake bug#12544.
+
+required=GNUmake
+. ./defs || exit 1
+
+cat >> configure.ac <<'END'
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+mkdir k ./--keep-going sub1 sub2
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1 sub2
+END
+
+cat > sub1/Makefile.am <<'END'
+all-local:
+       touch ko
+       false
+END
+cat > sub2/Makefile.am <<'END'
+all-local:
+       test -f ../sub1/ko
+       touch ok
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE -I k -I --keep-going TESTS='k --keep-going -k' && exit 1
+test ! -r sub2/ok
+
+! $MAKE -k && test -f sub2/ok || fatal_ '"make -k" not working as expected'
+
+:
-- 
1.7.12.317.g1c54b74



reply via email to

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