Bugzilla – Bug 1217355
Syntax of localhost entry is wrong in /etc/hosts
Last modified: 2024-01-12 16:02:38 UTC
Our /etc/hosts has: 127.0.0.1 localhost # fallback hostname used by NetworkManager 127.0.0.1 localhost.localdomain According to the documentation (man hosts), only one line per IP address is allowed. As result, the localhost.localdomain entry is not used: # getent hosts 127.0.0.1 127.0.0.1 localhost All hostnames for one IP must be in the same line.
Well then bug 1177835 / SR#907284 was fixed wrong.
$ getent hosts 127.0.0.1 localhost 127.0.0.1 localhost.localdomain
(In reply to André Werlang from comment #3) > $ getent hosts > 127.0.0.1 localhost > 127.0.0.1 localhost.localdomain What do you want to tell us with this? That listening the file line by line works? This does say nothing about if the syntax is correct or if the name is resolveable. And as I did show, 127.0.0.1 is not correct solveable. And if you look at the glibc source code, you will see that for resolving a host, the code does not go through every line, but stops at the first matching line. So your second line is not reached.
The fix has been pushed to Factory, closing as fixed. Thank you for spotting this bug.