gethostname(2) is supposed to return an unqualified name (on Debian and Ubuntu at least).
The Postfix docs say that "The default is to use the fully-qualified domain name from gethostname()." but gethostname() on Debian and Ubuntu will never return a fully-qualified name.
hostname -f returns the result of getaddrinfo(2) on gethostname(2), as defined in hostname(1).
Postfix, when $mydomain is not set and when the result of gethostname(2) is unqualified, appends ".localdomain", when you instead expect it to use what "hostname -f" returns and thus to use the result of getaddrinfo(2) on gethostname(2).
Sounds like a question for upstream to resolve to me. Can someone check this issue is still current upstream and check for and/or file a bug upstream as appropriate, please?
So...
gethostname(2) is supposed to return an unqualified name (on Debian and Ubuntu at least).
The Postfix docs say that "The default is to use the fully-qualified domain name from gethostname()." but gethostname() on Debian and Ubuntu will never return a fully-qualified name.
hostname -f returns the result of getaddrinfo(2) on gethostname(2), as defined in hostname(1).
Postfix, when $mydomain is not set and when the result of gethostname(2) is unqualified, appends ".localdomain", when you instead expect it to use what "hostname -f" returns and thus to use the result of getaddrinfo(2) on gethostname(2).
Sounds like a question for upstream to resolve to me. Can someone check this issue is still current upstream and check for and/or file a bug upstream as appropriate, please?