Package: apt-listchanges
Version: 4.8
Severity: normal
Tags: patch
Dear Maintainer,
I found that configuration fragments in /etc/apt/listchanges.conf.d/ are loaded
in a nondeterministic order.
This caused different effective configurations on two Debian 13 systems even
though they had the same apt-listchanges version and identical configuration
files.
The relevant code in apt_listchanges/ALCConfig.py is:
configs = [conf]
configs += glob(os.path.join(conf_d, '*.conf'))
self.read(configs)
Python's glob() does not guarantee any particular ordering. Therefore the order
in which configuration fragments override each other depends on the directory
enumeration order.
I reproduced this on two OpenMediaVault systems running Debian 13 and
apt-listchanges 4.8.
Both systems contained these files:
/etc/apt/listchanges.conf.d/95openmediavault.conf
/etc/apt/listchanges.conf.d/98openmediavault-mail.conf
95openmediavault.conf contains:
[apt]
which=both
email_address=none
email_format=html
headers=false
reverse=false
titled=true
98openmediavault-mail.conf contains:
[apt]
email_address=root
On the affected system, glob() returned:
/etc/apt/listchanges.conf.d/98openmediavault-mail.conf
/etc/apt/listchanges.conf.d/95openmediavault.conf
The resulting effective configuration was:
frontend = 'pager'
which = 'both'
email_address = None
email_format = 'html'
As a result, apt-listchanges did not send email because can_send_emails()
returned False.
On another system with the same apt-listchanges version and the same
configuration files, glob() returned:
/etc/apt/listchanges.conf.d/95openmediavault.conf
/etc/apt/listchanges.conf.d/98openmediavault-mail.conf
The resulting effective configuration was:
email_address = 'root'
and apt-listchanges email notifications worked correctly.
I tested the following one-line change on the affected system:
--- a/apt_listchanges/ALCConfig.py
+++ b/apt_listchanges/ALCConfig.py
@@
- configs += glob(os.path.join(conf_d, '*.conf'))
+ configs += sorted(glob(os.path.join(conf_d, '*.conf')))
After applying this change, the effective configuration became:
email_address = 'root'
which = 'both'
email_format = 'html'
I then performed a normal APT upgrade. The apt-listchanges hook ran normally
and the expected apt-listchanges email was successfully sent.
Therefore, sorting the configuration fragment filenames before passing them to
ConfigParser appears to fix the issue and makes the override order
deterministic.
The problem was reproduced with apt-listchanges 4.8 from Debian trixie. I have
not tested whether 4.8+nmu3 in testing/unstable is affected.
Regards,
Kenichiro Kakizaki
-- Package-specific info:
==> /etc/apt/listchanges.conf <==
[apt]
frontend=pager
which=news
email_address=root
email_format=text
confirm=false
headers=false
reverse=false
save_seen=/var/lib/apt/listchanges
==> /etc/apt/listchanges.conf.d/98openmediavault-mail.conf <==
[apt]
email_address=root
==> /etc/apt/listchanges.conf.d/95openmediavault.conf <==
# https://manpages.debian.org/trixie/apt-listchanges/apt-listchanges.1.en.html
[apt]
which=both
email_address=none
email_format=html
headers=false
reverse=false
titled=true
-- System Information:
Debian Release: 13.7
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 7.1.13+deb13-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE,
TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages apt-listchanges depends on:
ii apt 3.0.3
ii debconf [debconf-2.0] 1.5.91
ii python3 3.13.5-1
ii python3-apt 3.0.0
ii python3-debconf 1.5.91
ii sensible-utils 0.0.25
ii ucf 3.0052
apt-listchanges recommends no packages.
Versions of packages apt-listchanges suggests:
ii postfix [mail-transport-agent] 3.10.13-0+deb13u1
pn python3-gi <none>
pn www-browser <none>
pn x-terminal-emulator <none>
-- debconf information:
* apt-listchanges/reverse: false
* apt-listchanges/email-format: text
* apt-listchanges/save-seen: true
* apt-listchanges/email-address: root
* apt-listchanges/frontend: pager
apt-listchanges/no-network: false
* apt-listchanges/confirm: false
* apt-listchanges/headers: false
* apt-listchanges/which: news