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

Full log


View this message in rfc822 format

From: Tomas Volf <~@wolfsden.cz>
To: 79049 <at> debbugs.gnu.org
Subject: bug#79049: 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.




This bug report was last modified 20 days ago.

Previous Next


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