Comment 6 for bug 2019195

Revision history for this message
Paride Legovini (paride) wrote :

This is a valid postfix bug, uncovered by a change in the autopkgtest environment. We'll try to undo the change on the autopkgtest side, but the right way to fix the issue would be fixing postfix.

*Ideally* this should be fixed upstream, making postfix handle FQDNs with a trailing dot in myhostname. However fixing it in packaging is also good (no need for quilt patches). This could be done by making postinst script trim the trailing dot from the domain name before configuring myhostname. The relevant bit is the myfqdn() function in postfix.postinst:

myfqdn() {
    myhostname=$(hostname --fqdn 2>/dev/null || echo "")
    [...]
}

Reproducer:

---------------------------------------------------------
$ lxc launch ubuntu-daily:mantic paride-m
$ lxc exec paride-m bash

# hostname --fqdn
paride-m.lxd
# echo "127.0.1.1 foo.bar. foo" >> /etc/hosts
# hostnamectl hostname foo
# hostname --fqdn
foo.bar.

# apt install postfix
[...]
Running newaliases
newaliases: warning: valid_hostname: misplaced delimiter: foo.bar.
[...]
E: Sub-process /usr/bin/dpkg returned an error code (1)
---------------------------------------------------------

Given that postfix is currently a sync it would be nice to fix this in Debian:

https://salsa.debian.org/postfix-team/postfix-dev/-/blob/d3b9ba0c893fa45d8859e627d43dd3746ba915c7/debian/postfix.postinst#L37