NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/48881: /etc/hosts file parsing broken (since Aug 2013)



The following reply was made to PR lib/48881; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/48881: /etc/hosts file parsing broken (since Aug 2013)
Date: Sat, 14 Jun 2014 06:07:19 +0700

     Date:        Fri, 13 Jun 2014 22:05:00 +0000 (UTC)
     From:        "Greg A. Woods" <woods%planix.ca@localhost>
     Message-ID:  <20140613220500.E37EAA6550%mollari.NetBSD.org@localhost>
 
 Apart from your QP encoded patch being totally mangled by gnats,
 the fgetln fixes are probably needed but ...
 
   |  However the code still doesn't work correctly for the missing final
   |  newline case (i.e. the last entry in a hosts file with no final newline
   |  on that last entry cannot be found by name or by address).
 
 That should not be "fixed" - unix lines are terminated by newlines, a "line"
 that has no terminating newline is not a line at all, and should be
 ignored in places like that - in particular, one way (aside from using
 brain dead editors) to get such a state, is to write the file back to
 a full filesystem, the file will be truncated at the end of the last free
 available block, almost certainly in the middle of a line - using that broken
 line as if it were valid data would be a mistake.
 
 
 kre
 


Home | Main Index | Thread Index | Old Index