GNU bug report logs - #79049
ChangeLog is added to distribution even when inside a false conditional

Previous Next

Package: automake;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Sat, 19 Jul 2025 14:00:03 UTC

Severity: normal

To reply to this bug, email your comments to 79049 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#79049; Package automake. (Sat, 19 Jul 2025 14:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Sat, 19 Jul 2025 14:00:03 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: bug-automake <at> gnu.org
Subject: ChangeLog is added to distribution even when inside a false
 conditional
Date: Sat, 19 Jul 2025 15:59:20 +0200
Hello,

when you have a rule to generate ChangeLog inside a conditional, the
file is always added to am__DIST_COMMON, even when the conditional is
false.  This leads to a failure to build the tarball, since the
ChangeLog file nor the rule to build it exist.  I suspect it might be a
bug.

Following two files are enough to reproduce it:

configure.ac:
--8<---------------cut here---------------start------------->8---
AC_PREREQ([2.71])
AC_INIT([foo], [1])
AM_INIT_AUTOMAKE([foreign])

AM_CONDITIONAL([DISTRIBUTE_CHANGELOG], [false])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
--8<---------------cut here---------------end--------------->8---

Makefile.am:
--8<---------------cut here---------------start------------->8---
if DISTRIBUTE_CHANGELOG
ChangeLog:
	echo nop
endif
--8<---------------cut here---------------end--------------->8---

When I try to build a distribution tarball out of this, I am told:

--8<---------------cut here---------------start------------->8---
$ autoreconf -vfi . && ./configure && make dist
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /gnu/store/9gzl76xq8pz6hdrgai6ydnvmi13226xh-autoconf-2.71/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:3: installing './install-sh'
configure.ac:3: installing './missing'
autoreconf: Leaving directory '.'
checking for a BSD-compatible install... /gnu/store/8awm79px539lwhg6gczh4h3nx5kfdj1c-profile/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /gnu/store/8awm79px539lwhg6gczh4h3nx5kfdj1c-profile/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
make  dist-gzip am__post_remove_distdir='@:'
make[1]: Entering directory '/tmp/automake-repro'
make  distdir-am
make[2]: Entering directory '/tmp/automake-repro'
make[2]: *** No rule to make target 'ChangeLog', needed by 'distdir-am'.  Stop.
make[2]: Leaving directory '/tmp/automake-repro'
make[1]: *** [Makefile:261: distdir] Error 2
make[1]: Leaving directory '/tmp/automake-repro'
make: *** [Makefile:342: dist] Error 2
--8<---------------cut here---------------end--------------->8---

Notice that it tries to find ChangeLog, however fails to do so, since
the rule is commented out (due to the conditional).

After some more digging, I think the problem is handle_dist function,
specifically this part:

--8<---------------cut here---------------start------------->8---
      if (dir_has_case_matching_file ($relative_dir, $cfile)
	  # The file might be absent, but if it can be built it's ok.
	  || rule $cfile)
	{
	  push_dist_common ($cfile);
	}
--8<---------------cut here---------------end--------------->8---

There is this bullet point in the manual mentioning something like this:

> Automake has another built-in list of files automatically distributed
> if they are found either with the plain name, or with extension .md
> (presumably MarkDown, though this not checked). They are checked for
> in that order, so the plain name is preferred. These are: AUTHORS
> ChangeLog INSTALL NEWS README README-alpha THANKS.

So I think there are two problems:

1. The documentation does not mention this happens even if just a
   rule is found.
2. The code does not respect that the rule is if-ed away.

Have a nice day,
Tomas Volf

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.




Information forwarded to bug-automake <at> gnu.org:
bug#79049; Package automake. (Sat, 19 Jul 2025 22:09:02 GMT) Full text and rfc822 format available.

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

From: Karl Berry <karl <at> freefriends.org>
To: ~@wolfsden.cz
Cc: 79049 <at> debbugs.gnu.org
Subject: Re: bug#79049: ChangeLog is added to distribution even when inside a
 false conditional
Date: Sat, 19 Jul 2025 16:08:33 -0600
Thanks for the report and looking into the code. There have been
previous reports relating to targets and conditionals, e.g.,
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13940 (from 2013 ...)
and I think it's been mentioned in mail and elsewhere, too.

Updating the doc is no problem, thanks. But I'm not sure how to do a
real fix.  The conditional might be defined at configure-time, so
automake can't know whether it's true or not when it's running, as far
as I can see.

Maybe you or someone else has a clearer idea of how to proceed?
--thanks, karl.




Information forwarded to bug-automake <at> gnu.org:
bug#79049; Package automake. (Sun, 20 Jul 2025 19:59:01 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: Karl Berry <karl <at> freefriends.org>
Cc: 79049 <at> debbugs.gnu.org
Subject: Re: bug#79049: ChangeLog is added to distribution even when inside
 a false conditional
Date: Sun, 20 Jul 2025 21:58:13 +0200
Karl Berry <karl <at> freefriends.org> writes:

> Thanks for the report and looking into the code. There have been
> previous reports relating to targets and conditionals, e.g.,
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13940 (from 2013 ...)
> and I think it's been mentioned in mail and elsewhere, too.
>
> Updating the doc is no problem, thanks. But I'm not sure how to do a
> real fix.  The conditional might be defined at configure-time, so
> automake can't know whether it's true or not when it's running, as far
> as I can see.

Hm, this is very good point I failed to realize.

> Maybe you or someone else has a clearer idea of how to proceed?

Dropping the magic related to these special files is probably not
possible now, so only realistic option I see is to document the edge
case and move on.  Not great, so I hope someone will have a better
idea. :/

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.




This bug report was last modified 2 days ago.

Previous Next


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