]> git.ipfire.org Git - thirdparty/systemd.git/commit
hostnamed: stop discriminating against "localhost" in /etc/hostname
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Dec 2020 18:56:49 +0000 (19:56 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Dec 2020 10:02:18 +0000 (11:02 +0100)
commitd39079fcaa05e23540d2b1f0270fa31c22a7e9f1
tree48e72f8e78cc21686d520ce8a679f361ad54de58
parent468695c8cdab09ab8235b43133960c4e1b2e9e46
hostnamed: stop discriminating against "localhost" in /etc/hostname

We would sometimes ignore localhost-style names in /etc/hostname. That is
brittle. If the user configured some hostname, it's most likely because they
want to use that as the hostname. If they don't want to use such a hostname,
they should just not create the config. Everything becomes simples if we just
use the configured hostname as-is.

This behaviour seems to have been a workaround for Anaconda installer and other
tools writing out /etc/hostname with the default of "localhost.localdomain".
Anaconda PR to stop doing that: https://github.com/rhinstaller/anaconda/pull/3040.
That might have been useful as a work-around for other programs misbehaving if
/etc/hostname was not present, but nowadays it's not useful because systemd
mostly controls the hostname and it is perfectly happy without that file.

Apart from making things simpler, this allows users to set a hostname like
"localhost" and have it honoured, if such a whim strikes them.
man/hostnamectl.xml
src/hostname/hostnamed.c