Comment 0 for bug 1832672

Revision history for this message
Bruno (bruno-42) wrote : systemd-resolve not ignoring comments /etc/hosts

$ lsb_release -rd
Description: Ubuntu 18.04.2 LTS
Release: 18.04

$ LANG=C apt-cache policy systemd
systemd:
  Installed: 237-3ubuntu10.22
  Candidate: 237-3ubuntu10.22
  Version table:
 *** 237-3ubuntu10.22 500
        500 http://ch.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     237-3ubuntu10.19 500
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     237-3ubuntu10 500
        500 http://ch.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        500 http://mirrors.kernel.org/ubuntu bionic/main amd64 Packages

$ head -1 /etc/hosts
127.0.2.1 foo # bar

$ /usr/bin/systemd-resolve -4 bar

expected
----------
bar: resolve call failed: 'bar' not found

What happened instead
---------------------
bar: 127.0.2.1

HOSTS(5)
> Text from a "#" character until the end of the line is a comment, and is ignored.

This is fixed in upstream:
https://github.com/systemd/systemd/issues/10779
https://github.com/systemd/systemd/commit/bd0052777981044cf54a1e9d6e3acb1c3d813656

Please backport to current LTS version.
I accidentally connected to wrong systems because of this bug.