Archive for December, 2010

Good Touch, Bad Touch: /etc/hosts

Thursday, December 16th, 2010

Raise 'em up really high (stina jonsson, cc-by-nc-2.0)

So I’ll bet you thought touching a simple little file would be simple and a little code right?  So very wrong.  This is Linux we’re talking about, and if this stuff was simple, we’d already be enjoying our gin peartinis on the white sand beaches of St. Maarten with the latest dead tree from Johanna Lindsey.

See, your hostname needs to map to an IP address assigned to your computer, otherwise stuff gets angry.  Like X11, unless you have this hack.  Or quite a few other things are broken enough to look up the hostname to determine the machine’s IP address.  If your hostname isn’t in /etc/hosts, and it isn’t resolvable by DNS, or if DNS is down, or if your network cable got unplugged, or if it doesn’t map to an address assigned to your machine, or if /etc/resolv.conf isn’t set up right, this stuff just breaks.  That’s a lot of ifs.

Bad Touch

So since mid-2008, NetworkManager has tried to keep /etc/hosts updated with your current hostname, and since earlier this year, to map the current hostname to your default interface’s IP address.  Despite having 31 unit tests and fixing a bunch of bugs the code still doesn’t make everyone happy.  The Debian people want the hostname mapped to 127.0.1.1 not 127.0.0.1 (Fedora) or 127.0.0.2 (old Debian).  Which is fine.  Other people get touchy when stuff changes even if their special changes get preserved.  That’s also fine.  Others want to let DNS handle the hostname resolution even though that creates 3 more ways your machine can inexplicably hang.  And I’m tired of piling hacks on top of code that’s already really ugly and complicated.  Thank God for unit tests.

Good Touch

So here’s what we’re going to do.  After a third-quarter huddle with my linebackers, we’ll be removing all the code in NetworkManager that touches /etc/hosts. Gone are the bits that add your hostname.  Gone are the bits that remove your old hostname if it changes.  You now have all the rings of power.  Distros should use the “recommends” functionality of their package system to install nss-myhostname, which ensures that your hostname is always resolvable to a local IP address.  And if for some reason you don’t like that, you can uninstall it and keep /etc/hosts all to yourself.  Everyone wins!

And the best part?  I get to delete code.  I just love doing that.

Dear Nokia…

Wednesday, December 8th, 2010

Why is it that whenever I go to the Ovi store, it says:

Pardon the interruption
This site is currently undergoing maintenance.

and for some reason that maintenance always seems to take more than the two hours the Ovi blog says it will. In the mean time I’ve given up trying to get my angry birds or mapping program or desktop backgrounds or whatever.

News flash: nobody’s going to buy your shit if they can’t actually get to it in the first place.

I’m not aware of the App Store or the Android market being down for hours at the exact same time as I want to look for something. Leading me to two possible conclusions… either Nokia hates me, or their Ovi Store servers consist of actual monkies shoving bits of data into a pipe and those monkies all just got shot by poachers for the medicinal properties of the hair on their left earlobe. you tell me which is more likely.  I vote for number 2..