Fix failing mock builds, pass tests (#1736166)

Bug in hosts parsing reported error in comparing expected output.
Parse also last line of /etc/hosts.
This commit is contained in:
Petr Menšík 2019-09-10 17:09:13 +02:00
parent 46b038c6ed
commit b47f10fd42
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 1b41d34516968023c9eb97f0050f7393982c073b Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
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

View File

@ -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 <pemensik@redhat.com> - 0.0.1-0.26.20160317git
- Pass tests even without trailing newline in hosts (#1736166)
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.0.1-0.25.20160317git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild