Login
You're viewing the ruby.social public feed.
  • Nov 21, 2026, 4:30 AM

    *screaming in the distance*

    netbsd ignores the last line of /etc/hosts specifically

    super cool and great; love it

    💬 5🔄 1⭐ 0

Replies

  • Nov 22, 2026, 6:05 PM

    I found an existing netbsd bug report from 2014 about the bug parsing /etc/hosts: https://gnats.netbsd.org/48881

    as I half expected, there's some asshole defending the buggy behavior:

    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

    thankfully multiple other responders reply with some sense, but the bug remains unfixed

    and the netbsd bug tracker doesn't actually explain how to reply to an existing bug, so I guess my first step should be to report that as an issue

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 1
  • Nov 21, 2026, 4:36 AM

    @jordan @EveHasWords yeah! any entries in the file will be used, unless they're on the last line

    the last line is special for some reason, thrown away silently

    I've actually run into this idiotic bug before! because crontabs are the same way (or they used to be at least); the last line is silently ignored

    https://p.hagelb.org/intensifies.gif

    this caused me several hours of production data loss in 2007! so I learned my lesson and added (setq require-final-newline t) to my emacs config, except it didn't get applied here because I was editing /etc/hosts as root and I hadn't set up my emacs config for root, just my main user

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 21, 2026, 4:42 AM

    @technomancy Does it ignore the final line, or require a newline to end every line? The Emacs setting you mentioned makes sure there's a trailing newline, so ex. catting the file in a shell doesn't intermix the file contents and the next shell prompt), but doesn't add a whole blank line, which would be \n\n.

    I use the same setting, but just because I think it's polite.

    💬 1🔄 0⭐ 0
  • Nov 21, 2026, 4:45 AM

    @ieure yeah, if I had been editing this as my main user this would not have happened, but I was editing it as root where I didn't have my full emacs config there to save me

    fucking garbage parser

    💬 0🔄 0⭐ 0
  • Nov 21, 2026, 6:51 AM

    @technomancy that's a bug and if anyone claims it's not, you should direct your internal screaming outward

    💬 0🔄 0⭐ 2
  • Nov 21, 2026, 6:57 AM

    @meena the most wild part is that if you ping the hostname, it will use the entire /etc/hosts file, but as far as I could tell every other program on the system uses the broken parser instead

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0