From b47f10fd426e6a6c453a765065ec3c291e5c1601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Tue, 10 Sep 2019 17:09:13 +0200 Subject: [PATCH] Fix failing mock builds, pass tests (#1736166) Bug in hosts parsing reported error in comparing expected output. Parse also last line of /etc/hosts. --- netresolve-0.0.1-hosts.patch | 28 ++++++++++++++++++++++++++++ netresolve.spec | 7 ++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 netresolve-0.0.1-hosts.patch diff --git a/netresolve-0.0.1-hosts.patch b/netresolve-0.0.1-hosts.patch new file mode 100644 index 0000000..43dd715 --- /dev/null +++ b/netresolve-0.0.1-hosts.patch @@ -0,0 +1,28 @@ +From 1b41d34516968023c9eb97f0050f7393982c073b Mon Sep 17 00:00:00 2001 +From: Petr Mensik +Date: Tue, 10 Sep 2019 16:54:24 +0200 +Subject: [PATCH] Fix incorrect reading of hosts + +When last line is missing newline, data are not correctly read. Parse +also remaining parse space. +--- + backends/hosts.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/backends/hosts.c b/backends/hosts.c +index d3a076c..a93f74c 100644 +--- a/backends/hosts.c ++++ b/backends/hosts.c +@@ -160,7 +160,8 @@ read_list(struct hosts_list *list) + new = buffer - 1; + } + } +- ++ ++ read_item(list, buffer); + } + out: + close(fd); +-- +2.20.1 + diff --git a/netresolve.spec b/netresolve.spec index 4f80160..2d2d9ef 100644 --- a/netresolve.spec +++ b/netresolve.spec @@ -2,7 +2,7 @@ Name: netresolve Version: 0.0.1 -Release: 0.25%{?snapshot_suffix}%{?dist} +Release: 0.26%{?snapshot_suffix}%{?dist} Summary: Generic name resolution library License: BSD # https://github.com/crossdistro/netresolve , possibly? @@ -12,6 +12,8 @@ Source0: %{name}-0.0.1.tar.xz # From https://github.com/crossdistro/netresolve/pull/2 Patch0: netresolve-0.0.1-test-equality.patch Patch1: netresolve-0.0.1-strncpy.patch +# https://github.com/crossdistro/netresolve/issues/3 +Patch2: netresolve-0.0.1-hosts.patch BuildRequires: ldns-devel BuildRequires: pkgconfig(libcares) @@ -234,6 +236,9 @@ make check || { cat ./test-suite.log; false; } %{_libdir}/libnss_netresolve.so %changelog +* Tue Sep 10 2019 Petr Menšík - 0.0.1-0.26.20160317git +- Pass tests even without trailing newline in hosts (#1736166) + * Thu Jul 25 2019 Fedora Release Engineering - 0.0.1-0.25.20160317git - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild