+++ This bug was initially created as a clone of Bug #1452032 +++
Description of problem:
when the /etc/hosts file has a line longer than 1028 characters getent ahostsv4 and ahostsv6 will stop working for hostsnames present in /etc/hosts.
This happens even if the line is a comment.
Version-Release number of selected component (if applicable):
Tested in RHEL 6.9 and RHEL 7.3
Steps to Reproduce:
With this oneliner you can see how it stops resolving after the line reaches 1028 characters, even if it's commented.
echo -n '#' >>/etc/hosts ; for i in $(seq 1 1030); do echo -n "$i - "; echo -n 'a' >>/etc/hosts ; getent ahostsv4 `hostname -f`; done
It stops working after 1028 characters.
It continues working and at least ignores the commented line
--- Additional comment from Red Hat Bugzilla Rules Engine on 2017-05-18 04:12:24 EDT ---
Since this bug report was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.
The core issue is that getaddrinfo looks at h_errno even if nss_files returns NSS_STATUS_SUCCESS. The reproducer triggers an internal failure within nss_files, which overwrites h_errno, although the nss_files succeeds eventually.
Upstream, we will fix this by changing getaddrinfo, but *how* is not completely clear to me yet.
Downstream, we can either rebase getaddrinfo (more or less required to fix bug 168253), or patch nss_files not to leak the temporary h_errno value in this case.
Upstream patch posted: https://sourceware.org/ml/libc-alpha/2017-08/msg00292.html
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.