GNU bug report logs - #13940
Spurious target redefinition warnings with Automake conditionals

Previous Next

Package: automake;

Reported by: Nick Bowler <nbowler <at> draconx.ca>

Date: Wed, 13 Mar 2013 01:42:02 UTC

Severity: normal

Tags: confirmed, help

To reply to this bug, email your comments to 13940 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#13940; Package automake. (Wed, 13 Mar 2013 01:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nick Bowler <nbowler <at> draconx.ca>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Wed, 13 Mar 2013 01:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nick Bowler <nbowler <at> draconx.ca>
To: bug-automake <at> gnu.org
Subject: Spurious target redefinition warnings with Automake conditionals
Date: Tue, 12 Mar 2013 21:40:28 -0400
Consider the following:

  % cat >configure.ac <<'EOF'
AC_INIT([test], [0])

AM_INIT_AUTOMAKE([foreign])

AM_CONDITIONAL([FOO], [true])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

  % cat >Makefile.am <<'EOF'
if FOO
all-local: bar
bar: ; @echo bar
endif

all-local: baz
baz: ; @echo baz
EOF

On this input, Automake is producing the following warning:

  Makefile.am:6: warning: all-local was already defined in condition
FOO, which is included in condition TRUE ...
  Makefile.am:2: ... 'all-local' previously defined here

This warning makes no sense, because there is no problem with this
Makefile.am as far as I can see.  However, the warnings seem to be just
noise as the generated Makefile.in appears correct and works fine.

The conditional there is important: Automake only appears to warn when
one of the all-local rules is inside a conditional and the other is not.




Information forwarded to bug-automake <at> gnu.org:
bug#13940; Package automake. (Sat, 08 Jun 2013 15:51:01 GMT) Full text and rfc822 format available.

Message #8 received at 13940 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Nick Bowler <nbowler <at> draconx.ca>
Cc: 13940 <at> debbugs.gnu.org,
	"automake-patches <at> gnu.org" <automake-patches <at> gnu.org>
Subject: Re: bug#13940: Spurious target redefinition warnings with Automake
	conditionals
Date: Sat, 08 Jun 2013 17:50:20 +0200
[+cc automake-patches]

On 03/13/2013 02:40 AM, Nick Bowler wrote:
> Consider the following:
> 
>   % cat >configure.ac <<'EOF'
> AC_INIT([test], [0])
> 
> AM_INIT_AUTOMAKE([foreign])
> 
> AM_CONDITIONAL([FOO], [true])
> 
> AC_CONFIG_FILES([Makefile])
> AC_OUTPUT
> EOF
> 
>   % cat >Makefile.am <<'EOF'
> if FOO
> all-local: bar
> bar: ; @echo bar
> endif
> 
> all-local: baz
> baz: ; @echo baz
> EOF
> 
> On this input, Automake is producing the following warning:
> 
>   Makefile.am:6: warning: all-local was already defined in condition
> FOO, which is included in condition TRUE ...
>   Makefile.am:2: ... 'all-local' previously defined here
> 
> This warning makes no sense, because there is no problem with this
> Makefile.am as far as I can see.  However, the warnings seem to be just
> noise as the generated Makefile.in appears correct and works fine.
> 
> The conditional there is important: Automake only appears to warn when
> one of the all-local rules is inside a conditional and the other is not.
> 
>
I've exposed the bug with the patch inlined below.  Not sure when I'll
be able to attempt a proper fix.  If anyone wants to give it a try in
the meantime, be my guest!

Thanks,
  Stefano

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

From b2b3692d37e9812a5895b5a054da597731d7eb08 Mon Sep 17 00:00:00 2001
Message-Id: <b2b3692d37e9812a5895b5a054da597731d7eb08.1370706503.git.stefano.lattarini <at> gmail.com>
From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Date: Sat, 8 Jun 2013 17:47:30 +0200
Subject: [PATCH] tests: expose automake bug#13940

* t/override-conditional-pr13940.sh: New test, still xfailing.
* t/list-of-tests.mk (XFAIL_TESTS, handwritten_TESTS): Add it.

Signed-off-by: Stefano Lattarini <stefano.lattarini <at> gmail.com>
---
 t/list-of-tests.mk                |  2 ++
 t/override-conditional-pr13940.sh | 44 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 t/override-conditional-pr13940.sh

diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index fb2e444..68ca58c 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -33,6 +33,7 @@ t/all.sh \
 t/cond17.sh \
 t/gcj6.sh \
 t/override-conditional-2.sh \
+t/override-conditional-pr13940.sh \
 t/dist-pr109765.sh \
 t/instdir-cond2.sh \
 t/java-nobase.sh \
@@ -740,6 +741,7 @@ t/output13.sh \
 t/output-order.sh \
 t/override-conditional-1.sh \
 t/override-conditional-2.sh \
+t/override-conditional-pr13940.sh \
 t/override-html.sh \
 t/override-suggest-local.sh \
 t/parallel-am.sh \
diff --git a/t/override-conditional-pr13940.sh b/t/override-conditional-pr13940.sh
new file mode 100644
index 0000000..4bc4128
--- /dev/null
+++ b/t/override-conditional-pr13940.sh
@@ -0,0 +1,44 @@
+#! /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/>.
+
+# Expose automake bug#1394: automake erroneously think that a .PHONY
+# target's rule is overridden only because we declare dependencies
+# to such targets twice: one in an Automake conditional, and once
+# unconditionally.
+
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AM_CONDITIONAL([FOO], [true])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# The conditional here is important: Automake only appears to warn
+# when one of the all-local rules is inside a conditional and the
+# other is not.
+if FOO
+all-local: bar
+bar: ; @echo bar
+endif
+all-local: baz
+baz: ; @echo baz
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+:
-- 
1.8.3.rc3.8.g5e49f30





Added tag(s) help. Request was from Karl Berry <karl <at> freefriends.org> to control <at> debbugs.gnu.org. (Fri, 20 Nov 2020 02:06:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Karl Berry <karl <at> freefriends.org> to control <at> debbugs.gnu.org. (Fri, 20 Nov 2020 02:06:02 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.