Package: automake;
Reported by: Peter Johansson <peterandrejohansson <at> gmail.com>
Date: Sun, 16 Oct 2011 18:29:01 UTC
Severity: important
Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9768 in the body.
You can then email your comments to 9768 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Sun, 16 Oct 2011 18:29:01 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
:bug-automake <at> gnu.org
.
(Sun, 16 Oct 2011 18:29:01 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: bug-automake <at> gnu.org Cc: automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: Makefile broken after removing included *.am file Date: Sun, 16 Oct 2011 20:27:12 +0200
[Message part 1 (text/plain, inline)]
[me going through veeery old backlogs...] References: <http://lists.gnu.org/archive/html/bug-automake/2009-11/msg00005.html> <http://lists.gnu.org/archive/html/automake-patches/2009-11/msg00008.html> On Sunday 15 November 2009, Peter Johansson wrote: > Hello, > Hi Peter and automakers, and sorry for the ludicrous delay of this reply. > I included a file in my Makefile.am, but then I decided it was not > useful anymore so I removed the include statement and deleted the file. > That resulted in a broken Makefile, and running `make all' resulted in: > > make: *** No rule to make target `aminclude.am', needed by > `Makefile.in'. Stop. > > This is very similar to the "deleted header file problem" for *.m4 files > that was fixed in version 1.11 by adding a stub rule. I suppose this > problem could be solved in the same fashion. > Thanks for the report and the suggestion; I've been bitten few times by this bug myself, so I agree it's time to fix it. See the attached minimalistic patch, which I'll push to maint in a few days (as usual, reviews welcome). There is also a follow-up patch (attached as well) that ensures the stub rules do not end up covering real errors. With these two patches applied, the testsuite continues to pass both in maint and master. BTW, I see that the patches proposed by Ralf in the original threads (and linked above) have never been applied; anybody (ping ping Ralf ;-) knows why? Regards, Stefano
[0001-include-avoid-deleted-.am-file-problem.patch (text/x-patch, inline)]
From 0e8fe53d0ef3dac4901cecf5d576badb2cd6919b Mon Sep 17 00:00:00 2001 Message-Id: <0e8fe53d0ef3dac4901cecf5d576badb2cd6919b.1318789325.git.stefano.lattarini <at> gmail.com> From: Stefano Lattarini <stefano.lattarini <at> gmail.com> Date: Sun, 16 Oct 2011 14:57:37 +0200 Subject: [PATCH 1/2] include: avoid "deleted .am file" problem * lib/am/configure.am (%MAKEFILE-IN-DEPS%): New target without dependencies, to avoid the "deleted .am file" problem. * tests/remake-deleted-am.test: New test. * tests/remake-deleted-am-2.test: New test. * tests/remake-deleted-am-subdir.test: Likewise. * tests/remake-renamed-am.test: Likewise. * tests/Makefile.am (TESTS): Add them. * NEWS: Update. Report by Peter Johansson. See also commit `Release-1-10-40-gd0ebf71', which fixed a similar problem for .m4 files included by configure.ac. --- ChangeLog | 15 +++++++ NEWS | 4 ++ lib/am/configure.am | 3 + tests/Makefile.am | 4 ++ tests/Makefile.in | 4 ++ tests/remake-deleted-am-2.test | 77 ++++++++++++++++++++++++++++++++++ tests/remake-deleted-am-subdir.test | 79 +++++++++++++++++++++++++++++++++++ tests/remake-deleted-am.test | 69 ++++++++++++++++++++++++++++++ tests/remake-renamed-am.test | 60 ++++++++++++++++++++++++++ 9 files changed, 315 insertions(+), 0 deletions(-) create mode 100755 tests/remake-deleted-am-2.test create mode 100755 tests/remake-deleted-am-subdir.test create mode 100755 tests/remake-deleted-am.test create mode 100755 tests/remake-renamed-am.test diff --git a/ChangeLog b/ChangeLog index 171139c..65784a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2011-10-16 Stefano Lattarini <stefano.lattarini <at> gmail.com> + + include: avoid "deleted .am file" problem + * lib/am/configure.am (%MAKEFILE-IN-DEPS%): New target without + dependencies, to avoid the "deleted .am file" problem. + * tests/remake-deleted-am.test: New test. + * tests/remake-deleted-am-2.test: New test. + * tests/remake-deleted-am-subdir.test: Likewise. + * tests/remake-renamed-am.test: Likewise. + * tests/Makefile.am (TESTS): Add them. + * NEWS: Update. + Report by Peter Johansson. + See also commit `Release-1-10-40-gd0ebf71', which fixed a similar + problem for .m4 files included by configure.ac. + 2011-10-07 Stefano Lattarini <stefano.lattarini <at> gmail.com> parallel-tests: warn on conditional TEST_EXTENSIONS definition diff --git a/NEWS b/NEWS index 7e30ed0..7246754 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,10 @@ Bugs fixed in 1.11.0a: * Long standing bugs: + - The "deleted header file problem" for *.am files is avoided by stub + rules. This allows `make' to trigger a rerun of `automake' also if + some previously needed `.am' file has been removed. + - "make distcheck" now correctly complains also when "make uninstall" leaves one and only one file installed in $(prefix). diff --git a/lib/am/configure.am b/lib/am/configure.am index 594ec67..753e09b 100644 --- a/lib/am/configure.am +++ b/lib/am/configure.am @@ -83,6 +83,9 @@ endif %?TOPDIR_P% cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe);; \ esac; +## Avoid the "deleted header file" problem for the dependencies. +%MAKEFILE-IN-DEPS%: + DIST_COMMON += %MAKEFILE-AM% diff --git a/tests/Makefile.am b/tests/Makefile.am index 884ea65..af13b70 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -716,6 +716,10 @@ remake-subdir-gnu.test \ remake-subdir.test \ remake-subdir2.test \ remake-subdir-long-time.test \ +remake-deleted-am.test \ +remake-deleted-am-2.test \ +remake-deleted-am-subdir.test \ +remake-renamed-am.test \ pr8365-remake-timing.test \ regex.test \ req.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index f1bfcdd..e085762 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1000,6 +1000,10 @@ remake-subdir-gnu.test \ remake-subdir.test \ remake-subdir2.test \ remake-subdir-long-time.test \ +remake-deleted-am.test \ +remake-deleted-am-2.test \ +remake-deleted-am-subdir.test \ +remake-renamed-am.test \ pr8365-remake-timing.test \ regex.test \ req.test \ diff --git a/tests/remake-deleted-am-2.test b/tests/remake-deleted-am-2.test new file mode 100755 index 0000000..654f390 --- /dev/null +++ b/tests/remake-deleted-am-2.test @@ -0,0 +1,77 @@ +#! /bin/sh +# Copyright (C) 2011 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 inclusion of `.am' fragments by automake does not suffer +# of the "deleted header problem". This test checks deeper inclusion +# stacks, and use VPATH builds. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +$ACLOCAL +$AUTOCONF + +cat > Makefile.am <<'END' +include $(srcdir)/foo.am +END + +cat > foo.am <<'END' +# this is foo +include sub/bar.am +include baz.am +END + +mkdir sub +echo 'include $(top_srcdir)/sub/zardoz.am' > sub/bar.am +echo '# this is zardoz' > sub/zardoz.am + +echo 'include fnord.am' > baz.am +echo '# you are not seeing this' > fnord.am + +$AUTOMAKE +# Sanity checks. +$FGREP 'this is zardoz' Makefile.in +$FGREP 'you are not seeing this' Makefile.in + +mkdir build +cd build + +srcdir=.. + +$srcdir/configure +$MAKE + +$sleep +echo '# this is baz' > $srcdir/baz.am +rm -f $srcdir/fnord.am +$MAKE +# Sanity checks. +$FGREP 'you are not seeing this' $srcdir/Makefile.in Makefile && Exit 1 +$FGREP 'this is baz' $srcdir/Makefile.in +$FGREP 'this is baz' Makefile + +$sleep +rm -rf $srcdir/sub $srcdir/foo.am $srcdir/baz.am +echo '# no more inclusions' > $srcdir/Makefile.am +$MAKE +# Sanity checks. +$EGREP 'this is (foo|bar|baz)' Makefile $srcdir/Makefile.in && Exit 1 +$FGREP 'no more inclusions' Makefile + +: diff --git a/tests/remake-deleted-am-subdir.test b/tests/remake-deleted-am-subdir.test new file mode 100755 index 0000000..9ed1078 --- /dev/null +++ b/tests/remake-deleted-am-subdir.test @@ -0,0 +1,79 @@ +#! /bin/sh +# Copyright (C) 2011 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 inclusion of `.am' fragments by automake does not suffer +# of the "deleted header problem". This test does the check when the +# SUBDIRS variable is involved. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +AC_CONFIG_FILES([sub1/Makefile sub2/Makefile]) +AC_OUTPUT +END + +$ACLOCAL +$AUTOCONF + +cat > Makefile.am <<'END' +include foo.am +SUBDIRS = sub1 sub2 +END + +echo '# this is foo.am' > foo.am + +mkdir sub1 sub2 + +echo 'include $(srcdir)/bar.am' > sub1/Makefile.am +echo '# this is bar.am' > sub1/bar.am + +echo 'include $(top_srcdir)/foo.am' > sub2/Makefile.am + +$AUTOMAKE +# Sanity checks. +$FGREP 'this is foo.am' Makefile.in +$FGREP 'this is bar.am' sub1/Makefile.in +$FGREP 'this is foo.am' sub2/Makefile.in + +./configure +$MAKE # Should be no-op. + +$sleep +echo '# this is sub1/Makefile.am' > sub1/Makefile.am +rm -f sub1/bar.am +$MAKE all +# Sanity checks. +$FGREP 'this is bar' sub1/Makefile.in sub1/Makefile && Exit 1 +$FGREP 'this is sub1/Makefile.am' sub1/Makefile.in +$FGREP 'this is sub1/Makefile.am' sub1/Makefile + +$sleep +for d in . sub2; do + sed "s|.*include.*foo\.am.*|# this is $d/Makefile.am|" $d/Makefile.am > t + mv -f t $d/Makefile.am +done +rm -f foo.am +$MAKE all +# Sanity checks. +$FGREP 'this is foo' sub*/Makefile* Makefile* && Exit 1 +for d in . sub1 sub2; do + $FGREP "this is $d/Makefile.am" $d/Makefile.in + $FGREP "this is $d/Makefile.am" $d/Makefile +done + +: diff --git a/tests/remake-deleted-am.test b/tests/remake-deleted-am.test new file mode 100755 index 0000000..fa5a672 --- /dev/null +++ b/tests/remake-deleted-am.test @@ -0,0 +1,69 @@ +#! /bin/sh +# Copyright (C) 2011 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 inclusion of `.am' fragments by automake does not suffer +# of the "deleted header problem". Basic checks are done here. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +$ACLOCAL +$AUTOCONF + +cat > Makefile.am <<'END' +include foo.am +include $(srcdir)/bar.am +include $(top_srcdir)/baz.am +END + +echo '# this is foo' > foo.am +echo '# this is bar' > bar.am +echo '# this is baz' > baz.am + +$AUTOMAKE +# Sanity checks. +$FGREP 'this is foo' Makefile.in +$FGREP 'this is bar' Makefile.in +$FGREP 'this is baz' Makefile.in + +./configure +$MAKE # Should be no-op. + +$sleep +sed '/^include foo\.am$/d' Makefile.am > t +mv -f t Makefile.am +rm -f foo.am +$MAKE Makefile +# Sanity checks. +$FGREP 'this is foo' Makefile.in Makefile && Exit 1 +$FGREP 'this is bar' Makefile.in +$FGREP 'this is bar' Makefile +$FGREP 'this is baz' Makefile.in +$FGREP 'this is baz' Makefile + +$sleep +echo '# empty empty' > Makefile.am +rm -f bar.am baz.am +$MAKE Makefile +# Sanity checks. +$FGREP 'empty empty' Makefile.in +$FGREP 'empty empty' Makefile +grep 'this is ba[rz]' Makefile Makefile.in && Exit 1 + +: diff --git a/tests/remake-renamed-am.test b/tests/remake-renamed-am.test new file mode 100755 index 0000000..b3a7a41 --- /dev/null +++ b/tests/remake-renamed-am.test @@ -0,0 +1,60 @@ +#! /bin/sh +# Copyright (C) 2011 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 inclusion of `.am' fragments by automake does not suffer +# of the "deleted header problem". This test checks that we can rename +# an included .am file without confusing the remake rules. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am <<'END' +include foo.am +END + +cat > foo.am <<'END' +all-local: + echo ok > has-run-1 +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure +$MAKE +test -f has-run-1 + +$sleep +rm -f has-run-1 +mv -f foo.am bar.am +echo include bar.am > Makefile.am +$MAKE Makefile +$FGREP 'foo.am' Makefile Makefile.in && Exit 1 + +$sleep +rm -f has-run-1 bar.am +echo 'all-local:; echo ok > has-run-2' > zardoz.am +echo 'include $(srcdir)/zardoz.am' > Makefile.am +using_gmake || $MAKE Makefile +$MAKE +test ! -f has-run-1 +test -f has-run-2 + +: -- 1.7.2.3
[0002-coverage-required-but-missing-.am-and-.m4-files-are-.patch (text/x-patch, inline)]
From 120eab98add774cef856c211b436dcb3719a791e Mon Sep 17 00:00:00 2001 Message-Id: <120eab98add774cef856c211b436dcb3719a791e.1318789325.git.stefano.lattarini <at> gmail.com> In-Reply-To: <0e8fe53d0ef3dac4901cecf5d576badb2cd6919b.1318789325.git.stefano.lattarini <at> gmail.com> References: <0e8fe53d0ef3dac4901cecf5d576badb2cd6919b.1318789325.git.stefano.lattarini <at> gmail.com> From: Stefano Lattarini <stefano.lattarini <at> gmail.com> Date: Sun, 16 Oct 2011 17:07:19 +0200 Subject: [PATCH 2/2] coverage: required but missing '.am' and '.m4' files are diagnosed The stub rules emitted to work around the "deleted header problem" for `.m4' files (included by autoconf in e.g., configure.ac) and for `.am' files (included by automake in e.g., Makefile.am) should not prevent the remake rules from correctly erroring out when a still-required file is missing. * tests/deleted-am.test: New test. * tests/deleted-m4.test: Likewise. * tests/Makefile.am (TESTS): Add them. --- ChangeLog | 12 +++++++++ tests/Makefile.am | 2 + tests/deleted-am.test | 58 +++++++++++++++++++++++++++++++++++++++++++ tests/deleted-m4.test | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 0 deletions(-) create mode 100755 tests/deleted-am.test create mode 100755 tests/deleted-m4.test diff --git a/ChangeLog b/ChangeLog index 65784a4..e5cf3cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2011-10-16 Stefano Lattarini <stefano.lattarini <at> gmail.com> + coverage: required but missing '.am' and '.m4' files are diagnosed + The stub rules emitted to work around the "deleted header problem" + for `.m4' files (included by autoconf in e.g., configure.ac) and + for `.am' files (included by automake in e.g., Makefile.am) should + not prevent the remake rules from correctly erroring out when a + still-required file is missing. + * tests/deleted-am.test: New test. + * tests/deleted-m4.test: Likewise. + * tests/Makefile.am (TESTS): Add them. + +2011-10-16 Stefano Lattarini <stefano.lattarini <at> gmail.com> + include: avoid "deleted .am file" problem * lib/am/configure.am (%MAKEFILE-IN-DEPS%): New target without dependencies, to avoid the "deleted .am file" problem. diff --git a/tests/Makefile.am b/tests/Makefile.am index af13b70..3487d95 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -295,6 +295,8 @@ dejagnu4.test \ dejagnu5.test \ dejagnu6.test \ dejagnu7.test \ +deleted-am.test \ +deleted-m4.test \ depacl2.test \ depcomp.test \ depcomp2.test \ diff --git a/tests/deleted-am.test b/tests/deleted-am.test new file mode 100755 index 0000000..29d104c --- /dev/null +++ b/tests/deleted-am.test @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 2011 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/>. + +# The stub rules emitted to work around the "deleted header problem" +# for `.am' files shouldn't prevent the remake rules from correctly +# erroring out when a still-required file is missing. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +echo 'include $(top_srcdir)/foobar.am' > Makefile.am +echo 'include zardoz.am' > foobar.am +: > zardoz.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE + +rm -f zardoz.am +$MAKE >output 2>&1 && { cat output; Exit 1; } +cat output +# This error will come from automake, not make, so we can be stricter +# in our grepping of it. +grep 'cannot open.*zardoz\.am' output +grep 'foobar\.am' output && Exit 1 # No spurious error, please. + +# Try with one less indirection. +: > foobar.am +$AUTOMAKE Makefile +./config.status Makefile +$MAKE # Sanity check. +rm -f foobar.am +$MAKE >output 2>&1 && { cat output; Exit 1; } +cat output +# This error will come from automake, not make, so we can be stricter +# in our grepping of it. +grep 'cannot open.*foobar\.am' output + +: diff --git a/tests/deleted-m4.test b/tests/deleted-m4.test new file mode 100755 index 0000000..3114bcd --- /dev/null +++ b/tests/deleted-m4.test @@ -0,0 +1,66 @@ +#! /bin/sh +# Copyright (C) 2011 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/>. + +# The stub rules emitted to work around the "deleted header problem" +# for `.m4' files shouldn't prevent the remake rules from correctly +# erroring out when a still-required file is missing. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +m4_include([foobar.m4]) +AC_OUTPUT +END + +: > Makefile.am + +echo 'm4_include([zardoz.m4])' > foobar.m4 +: > zardoz.m4 + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure +$MAKE + +rm -f zardoz.m4 +$MAKE >output 2>&1 && { cat output; Exit 1; } +cat output +# This error will come from aclocal, not make, so we can be stricter +# in our grepping of it. +grep ' foobar\.m4:1:.*zardoz\.m4.*does not exist' output +# No spurious errors, please. +$FGREP -v ' foobar.m4:1:' output | $FGREP 'foobar.m4' && Exit 1 + +# Try with one less indirection. +: > foobar.m4 +$ACLOCAL --force +$AUTOCONF +./configure +$MAKE # Sanity check. +rm -f foobar.m4 +$MAKE >output 2>&1 && { cat output; Exit 1; } +cat output +# This error will come from aclocal, not make, so we can be stricter +# in our grepping of it. +grep 'foobar\.m4.*does not exist' output +# No spurious errors, please (ok, this is really paranoid). +$FGREP 'zardoz.m4' output && Exit 1 + +: -- 1.7.2.3
bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Sun, 16 Oct 2011 18:33:02 GMT) Full text and rfc822 format available.Message #8 received at 9768 <at> debbugs.gnu.org (full text, mbox):
From: "Ralf Wildenhues" <Ralf.Wildenhues <at> gmx.de> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9768 <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Sun, 16 Oct 2011 20:31:56 +0200
Hello, * Stefano Lattarini wrote on Sun, Oct 16, 2011 at 08:27:12PM CEST: > On Sunday 15 November 2009, Peter Johansson wrote: > > make: *** No rule to make target `aminclude.am', needed by > > `Makefile.in'. Stop. > > > > This is very similar to the "deleted header file problem" for *.m4 files > > that was fixed in version 1.11 by adding a stub rule. I suppose this > > problem could be solved in the same fashion. > > > Thanks for the report and the suggestion; I've been bitten few times by > this bug myself, so I agree it's time to fix it. See the attached > minimalistic patch, which I'll push to maint in a few days (as usual, > reviews welcome). There is also a follow-up patch (attached as well) > that ensures the stub rules do not end up covering real errors. What happens if I write include fragment-with-typo-in-name.am but I want that fragment included? IIUC then automake will still error out when it gets rerun, but because of the way dependencies are handled now, it won't get rerun automatically, right? Thanks, Ralf
bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Mon, 17 Oct 2011 08:22:01 GMT) Full text and rfc822 format available.Message #11 received at 9768 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: "Ralf Wildenhues" <Ralf.Wildenhues <at> gmx.de> Cc: 9768 <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Mon, 17 Oct 2011 10:20:05 +0200
On Sunday 16 October 2011, Ralf Wildenhues wrote: > Hello, > Hi Ralf. > * Stefano Lattarini wrote on Sun, Oct 16, 2011 at 08:27:12PM CEST: > > On Sunday 15 November 2009, Peter Johansson wrote: > > > make: *** No rule to make target `aminclude.am', needed by > > > `Makefile.in'. Stop. > > > > > > This is very similar to the "deleted header file problem" for *.m4 files > > > that was fixed in version 1.11 by adding a stub rule. I suppose this > > > problem could be solved in the same fashion. > > > > > Thanks for the report and the suggestion; I've been bitten few times by > > this bug myself, so I agree it's time to fix it. See the attached > > minimalistic patch, which I'll push to maint in a few days (as usual, > > reviews welcome). There is also a follow-up patch (attached as well) > > that ensures the stub rules do not end up covering real errors. > > What happens if I write > include fragment-with-typo-in-name.am > > but I want that fragment included? > I fear I cannot parse this question... Do you mean that you want to include the file `bar.am' but erronously write "include baz.am" in your Makefile.am instead? In this case, automake will obviously complain and bail out, as it did before my patch (in fact, said patch doesn't touch the automake script at all, so this invariance of its behaviour should be obvious). > IIUC then automake will still error out when it gets rerun, but > because of the way dependencies are handled now, it won't get rerun > automatically, right? > Why not? If you change `Makefile.am', the automake-generated makefiles will know that they have to rebuild the corresponding `Makefile.in', so they'll invoke automake -- which will dutifully fail if any file included by the `Makefile.am' does not exist. See also the new `deleted-am.test' test script in my second patch, which should check this behaviour. But all of this seems pretty obvious (unless I'm missing something really fundamental), so I think I must be misunderstanding your questions/doubts here... Regards, Stefano
Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Mon, 17 Oct 2011 09:38:02 GMT) Full text and rfc822 format available.bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Wed, 19 Oct 2011 19:09:02 GMT) Full text and rfc822 format available.Message #16 received at 9768 <at> debbugs.gnu.org (full text, mbox):
From: "Ralf Wildenhues" <Ralf.Wildenhues <at> gmx.de> To: Stefano Lattarini <stefano.lattarini <at> gmail.com> Cc: 9768 <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Wed, 19 Oct 2011 21:06:54 +0200
* Stefano Lattarini wrote on Mon, Oct 17, 2011 at 10:20:05AM CEST: > On Sunday 16 October 2011, Ralf Wildenhues wrote: > > What happens if I write > > include fragment-with-typo-in-name.am > > > > but I want that fragment included? > > > I fear I cannot parse this question... Do you mean that you want to > include the file `bar.am' but erronously write "include baz.am" in your > Makefile.am instead? In this case, automake will obviously complain > and bail out, as it did before my patch (in fact, said patch doesn't > touch the automake script at all, so this invariance of its behaviour > should be obvious). Alright. The first time you write the include line and invoke automake, it will bail out if there is a typo. But if the fragment file is later (re)moved, and you type 'make' again, you will not get an error, as automake will not be rerun automatically. Only when automake is invoked manually, or triggered by some other out of date file, will the error be noticed. Taken a step further, if some fragment file for some reason does not get included in a release tarball, then the developer might not see that during testing, but users will miss a file needed to tinker with the package. Am I missing something? Thanks, Ralf
bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Thu, 20 Oct 2011 10:23:01 GMT) Full text and rfc822 format available.Message #19 received at 9768 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: "Ralf Wildenhues" <Ralf.Wildenhues <at> gmx.de> Cc: 9768 <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Thu, 20 Oct 2011 12:21:25 +0200
[Message part 1 (text/plain, inline)]
On Wednesday 19 October 2011, Ralf Wildenhues wrote: > * Stefano Lattarini wrote on Mon, Oct 17, 2011 at 10:20:05AM CEST: > > On Sunday 16 October 2011, Ralf Wildenhues wrote: > > > What happens if I write > > > include fragment-with-typo-in-name.am > > > > > > but I want that fragment included? > > > > > I fear I cannot parse this question... Do you mean that you want to > > include the file `bar.am' but erronously write "include baz.am" in your > > Makefile.am instead? In this case, automake will obviously complain > > and bail out, as it did before my patch (in fact, said patch doesn't > > touch the automake script at all, so this invariance of its behaviour > > should be obvious). > > Alright. The first time you write the include line and invoke automake, > it will bail out if there is a typo. > Yes. > But if the fragment file is later (re)moved, and you type 'make' again, > you will not get an error, as automake will not be rerun automatically. > Hmm... but `Makefile.in' depends on the included file that has just been removed, so `make' will try to rebuild this file -- and after my patch this will be a no-op, due to the new stub rules -- and will then try to rebuild `Makefile.in' by invoking `automake' -- which will fail due to the missing include file. > Only when automake is invoked manually, or triggered by some other > out of date file, will the error be noticed. > This is not true; and in fact, I've added a new test case to ensure we don't regress in this regard (see `deleted-am.test'). > Taken a step further, if some fragment file for some reason does not > get included in a release tarball, then the developer might not see > that during testing, > This shouldn't be a serious problem, since Automake takes care of automatically distributing included `.am' files. But even if the dist tarball gets messed up in strage ways, and some `.am' files get removed from it, the same reasoning given above should apply, so the error will be caught. Still, it would be nice to have a testcase for this (as well as for the sister situations with included `.m4' files). So I'd like to queue the attached patch as well. [NOTE: while writing this patch, I've hit another automake bug/limitation, that I will report in a new thread soonish]. > but users will miss a file needed to tinker with the package. > > Am I missing something? > I hope so :-) -- otherwise I've completely misunderstood something cardinal here. Thanks, Stefano
[0001-coverage-undistributed-.am-and-.m4-files-are-diagnos.patch (text/x-patch, inline)]
From 4fa17ed7b6d631a70d84129cbb169578def362ba Mon Sep 17 00:00:00 2001 Message-Id: <4fa17ed7b6d631a70d84129cbb169578def362ba.1319104807.git.stefano.lattarini <at> gmail.com> From: Stefano Lattarini <stefano.lattarini <at> gmail.com> Date: Thu, 20 Oct 2011 11:55:01 +0200 Subject: [PATCH] coverage: undistributed '.am' and '.m4' files are diagnosed The stub rules emitted to work around the "deleted header problem" for `.m4' files (included by autoconf in e.g., configure.ac) and for `.am' files (included by automake in e.g., Makefile.am) should not prevent "make" from correctly complaining when such a required file is missing from a distribution tarball. * tests/dist-missing-am.test: New test. * tests/dist-missing-m4.test: Likewise. * tests/dist-missing-included-m4.test: Likewise. * tests/Makefile.am (TESTS): Add them. Suggestion by Ralf Wildenhues. --- ChangeLog | 14 +++++++ tests/dist-missing-am.test | 67 +++++++++++++++++++++++++++++++++ tests/dist-missing-included-m4.test | 69 ++++++++++++++++++++++++++++++++++ tests/dist-missing-m4.test | 71 +++++++++++++++++++++++++++++++++++ 4 files changed, 221 insertions(+), 0 deletions(-) create mode 100755 tests/dist-missing-am.test create mode 100755 tests/dist-missing-included-m4.test create mode 100755 tests/dist-missing-m4.test diff --git a/ChangeLog b/ChangeLog index e5cf3cd..1699347 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2011-10-20 Stefano Lattarini <stefano.lattarini <at> gmail.com> + + coverage: undistributed '.am' and '.m4' files are diagnosed + The stub rules emitted to work around the "deleted header problem" + for `.m4' files (included by autoconf in e.g., configure.ac) and + for `.am' files (included by automake in e.g., Makefile.am) should + not prevent "make" from correctly complaining when such a required + file is missing from a distribution tarball. + * tests/dist-missing-am.test: New test. + * tests/dist-missing-m4.test: Likewise. + * tests/dist-missing-included-m4.test: Likewise. + * tests/Makefile.am (TESTS): Add them. + Suggestion by Ralf Wildenhues. + 2011-10-16 Stefano Lattarini <stefano.lattarini <at> gmail.com> coverage: required but missing '.am' and '.m4' files are diagnosed diff --git a/tests/dist-missing-am.test b/tests/dist-missing-am.test new file mode 100755 index 0000000..97f4ff5 --- /dev/null +++ b/tests/dist-missing-am.test @@ -0,0 +1,67 @@ +#! /bin/sh +# Copyright (C) 2011 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/>. + +# The stub rules emitted to work around the "deleted header problem" +# for `.am' files shouldn't prevent "make" from diagnosing a missing +# required `.am' file from a distribution tarball. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am <<'END' +include $(srcdir)/foobar.am +include $(srcdir)/zardoz.am +END + +: > foobar.am +: > zardoz.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +# A faulty distribution tarball, with a required `.am' file missing. +# Building from it should fail, both for in-tree and VPATH builds. +ocwd=`pwd` || fatal_ "cannot get current working directory" +for vpath in false :; do + $MAKE distdir + test -f $distdir/zardoz.am # Sanity check. + rm -f $distdir/zardoz.am + if $vpath; then + # We can't just build in a subdirectory of $distdir, otherwise + # we'll hit automake bug#???? (FIXME: yet to be reported). + mkdir vpath-distcheck + cd vpath-distcheck + ../$distdir/configure + else + cd $distdir + ./configure + fi + $MAKE >output 2>&1 && { cat output; Exit 1; } + cat output + # This error comes from automake, not make, so we can be stricter + # in our grepping of it. + grep 'cannot open.*zardoz\.am' output + grep 'foobar\.am' output && Exit 1 # No spurious error, please. + cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" +done + +: diff --git a/tests/dist-missing-included-m4.test b/tests/dist-missing-included-m4.test new file mode 100755 index 0000000..ea7ebff --- /dev/null +++ b/tests/dist-missing-included-m4.test @@ -0,0 +1,69 @@ +#! /bin/sh +# Copyright (C) 2011 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/>. + +# The stub rules emitted to work around the "deleted header problem" +# for `.m4' files shouldn't prevent "make" from diagnosing a missing +# required `.m4' file from a distribution tarball. +# See also sister test `dist-missing-m4.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +m4_include([foobar.m4]) +m4_include([zardoz.m4]) +AC_OUTPUT +END + +: > foobar.m4 +: > zardoz.m4 + +: > Makefile.am + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +./configure + +# A faulty distribution tarball, with a required `.m4' file missing. +# Building from it should fail, both for in-tree and VPATH builds. +ocwd=`pwd` || fatal_ "cannot get current working directory" +for vpath in false :; do + $MAKE distdir + test -f $distdir/zardoz.m4 # Sanity check. + rm -f $distdir/zardoz.m4 + if $vpath; then + # We can't just build in a subdirectory of $distdir, otherwise + # we'll hit automake bug#???? (FIXME: yet to be reported). + mkdir vpath-distcheck + cd vpath-distcheck + ../$distdir/configure + else + cd $distdir + ./configure + fi + $MAKE >output 2>&1 && { cat output; Exit 1; } + cat output + # This error will come from automake, not make, so we can be stricter + # in our grepping of it. + grep 'zardoz\.m4.*does not exist' output + grep 'foobar\.m4' output && Exit 1 # No spurious error, please. + cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" +done + +: diff --git a/tests/dist-missing-m4.test b/tests/dist-missing-m4.test new file mode 100755 index 0000000..34e0030 --- /dev/null +++ b/tests/dist-missing-m4.test @@ -0,0 +1,71 @@ +#! /bin/sh +# Copyright (C) 2011 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/>. + +# The stub rules emitted to work around the "deleted header problem" +# for `.m4' files shouldn't prevent "make" from diagnosing a missing +# required `.m4' file from a distribution tarball. +# See also sister test `dist-missing-included-m4.test'. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in <<'END' +m4_pattern_forbid([^MY_]) +MY_FOOBAR || exit 1 +MY_ZARDOZ || exit 1 +AC_OUTPUT +END + +mkdir m4 +echo 'AC_DEFUN([MY_FOOBAR], [:])' > m4/foobar.m4 +echo 'AC_DEFUN([MY_ZARDOZ], [:])' > m4/zardoz.m4 + +echo 'ACLOCAL_AMFLAGS = -I m4' > Makefile.am + +$ACLOCAL -I m4 +$AUTOCONF +$AUTOMAKE + +./configure + +# A faulty distribution tarball, with a required `.m4' file missing. +# Building from it should fail, both for in-tree and VPATH builds. +ocwd=`pwd` || fatal_ "cannot get current working directory" +for vpath in false :; do + $MAKE distdir + test -f $distdir/m4/zardoz.m4 # Sanity check. + rm -f $distdir/m4/zardoz.m4 + if $vpath; then + # We can't just build in a subdirectory of $distdir, otherwise + # we'll hit automake bug#???? (FIXME: yet to be reported). + mkdir vpath-distcheck + cd vpath-distcheck + ../$distdir/configure + else + cd $distdir + ./configure + fi + $MAKE >output 2>&1 && { cat output; Exit 1; } + cat output + # This error will come from autoconf, not make, so we can be stricter + # in our grepping of it. + grep 'possibly undefined .*MY_ZARDOZ' output + grep 'MY_FOOBAR' output && Exit 1 # No spurious error, please. + cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory" +done + +: -- 1.7.2.3
bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Sun, 23 Oct 2011 18:18:01 GMT) Full text and rfc822 format available.Message #22 received at 9768 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: "Ralf Wildenhues" <Ralf.Wildenhues <at> gmx.de> Cc: 9768 <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Sun, 23 Oct 2011 20:15:27 +0200
Hi Ralf. On Thursday 20 October 2011, Stefano Lattarini wrote: > On Wednesday 19 October 2011, Ralf Wildenhues wrote: > > > > Am I missing something? > > > I hope so :-) -- otherwise I've completely misunderstood something > cardinal here. > Ping on this? I'd like to have this patch in 1.11.2 (unless it turns out it's completely broken, of course ;-), so the earlier we can work out our doubts and disagreements, the better. Thanks (and sorry if I'm being a little pushy), Stefano
bug-automake <at> gnu.org
:bug#9768
; Package automake
.
(Tue, 22 Nov 2011 21:22:01 GMT) Full text and rfc822 format available.Message #25 received at 9768 <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: "Ralf Wildenhues" <Ralf.Wildenhues <at> gmx.de> Cc: 9768 <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Tue, 22 Nov 2011 22:19:35 +0100
On Sunday 23 October 2011, Stefano Lattarini wrote: > Hi Ralf. > > On Thursday 20 October 2011, Stefano Lattarini wrote: > > On Wednesday 19 October 2011, Ralf Wildenhues wrote: > > > > > > Am I missing something? > > > > > I hope so :-) -- otherwise I've completely misunderstood something > > cardinal here. > > > Ping on this? I'd like to have this patch in 1.11.2 (unless it turns > out it's completely broken, of course ;-), so the earlier we can work > out our doubts and disagreements, the better. > > Thanks (and sorry if I'm being a little pushy), > Stefano > For the moment, I've pushed two changes that enhance the testsuite coverage w.r.t. expected remake errors in situations/setups that might be touched by the proposed patch. See: <http://lists.gnu.org/archive/html/automake-patches/2011-11/msg00054.html> <http://lists.gnu.org/archive/html/automake-patches/2011-11/msg00055.html> Regards, Stefano
Stefano Lattarini <stefano.lattarini <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 07 Dec 2011 22:54:02 GMT) Full text and rfc822 format available.Stefano Lattarini <stefano.lattarini <at> gmail.com>
:Peter Johansson <peterandrejohansson <at> gmail.com>
:Message #32 received at 9768-done <at> debbugs.gnu.org (full text, mbox):
From: Stefano Lattarini <stefano.lattarini <at> gmail.com> To: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> Cc: 9768-done <at> debbugs.gnu.org, automake-patches <at> gnu.org, Peter Johansson <peterandrejohansson <at> gmail.com> Subject: Re: bug#9768: Makefile broken after removing included *.am file Date: Thu, 22 Dec 2011 19:20:34 +0100
[Message part 1 (text/plain, inline)]
References: <http://lists.gnu.org/archive/html/automake-patches/2011-11/msg00056.html> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9768> On 11/22/2011 10:19 PM, Stefano Lattarini wrote: > > For the moment, I've pushed two changes that enhance the testsuite > coverage w.r.t. expected remake errors in situations/setups that might > be touched by the proposed patch. See: > <http://lists.gnu.org/archive/html/automake-patches/2011-11/msg00054.html> > <http://lists.gnu.org/archive/html/automake-patches/2011-11/msg00055.html> > > Regards, > Stefano > And I've finally applied the attached patch to fix the bug. I'm thus closing this bug report. Regards, Stefano
[0001-include-avoid-deleted-.am-file-problem.patch (text/x-diff, attachment)]
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Fri, 20 Jan 2012 12:24:05 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.