[Bug 1832672] Re: systemd-resolve not ignoring comments in /etc/hosts
Dan Streetman
ddstreet at canonical.com
Wed Nov 20 06:51:43 UTC 2019
ubuntu at lp1832672-b:~$ dpkg -l systemd|grep ii
ii systemd 237-3ubuntu10.31 amd64 system and service manager
ubuntu at lp1832672-b:~$ grep bar /etc/hosts
127.0.2.1 foo # bar
ubuntu at lp1832672-b:~$ systemd-resolve -4 bar
bar: 127.0.2.1
-- Information acquired via protocol DNS in 1.9ms.
-- Data is authenticated: yes
ubuntu at lp1832672-b:~$ dpkg -l systemd|grep ii
ii systemd 237-3ubuntu10.33 amd64 system and service manager
ubuntu at lp1832672-b:~$ grep bar /etc/hosts
127.0.2.1 foo # bar
ubuntu at lp1832672-b:~$ systemd-resolve -4 bar
bar: resolve call failed: 'bar' not found
** Tags removed: verification-needed verification-needed-bionic
** Tags added: verification-done verification-done-bionic
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1832672
Title:
systemd-resolve not ignoring comments in /etc/hosts
Status in systemd:
Unknown
Status in systemd package in Ubuntu:
Fix Released
Status in systemd source package in Bionic:
Fix Committed
Bug description:
[impact]
resolved does not ignore comments properly in /etc/hosts
[test case]
see original description below
[regression potential]
as this modifies resolved parsing of /etc/hosts, regressions would
likely be in hostname lookups from hosts in /etc/hosts, or failure(s)
to parse /etc/hosts correctly.
[other info]
original description:
---
$ 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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/systemd/+bug/1832672/+subscriptions
More information about the foundations-bugs
mailing list