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: David Holland <>
Subject: Re: lib/48881: /etc/hosts file parsing broken (since Aug 2013)
Date: Wed, 18 Jun 2014 03:13:16 +0000

 On Sat, Jun 14, 2014 at 03:10:05AM +0000, Greg A. Woods wrote:
  >>  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.
  >  I understand what you are saying, and for the most part I agree with
  >  you, but I think there are worse problems caused by not parsing the text
  >  after the last newline in files that don't end in a newline.
  > [...]
 I mostly don't agree: a partial line should either be a line or a
 syntax error, and in either case ignoring it silently is wrong :-)
 David A. Holland

Home | Main Index | Thread Index | Old Index