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.
View this message in rfc822 format
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: 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
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.