Skip to content

No route to host vs. -EHOSTUNREACH

This has bothered me for quite a while, years even:
# strace ssh bob
[...]
connect(3, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("192.168.10.11")}, \
            16) = -1 EHOSTUNREACH (No route to host)
....while there clearly is a route to this host - it's just that bob is currently down. I think EHOSTUNREACH is the Right Thing to return, but the description "No route to host" is not. Unfortunately, it's apparently not that easy to convince the libc people to fix this :(

cannot set date: Invalid argument

While playing around with GNU/date, this happened:
# date
Wed Jul 22 10:24:05 CEST 2009
# date --set='1970-01-01'
date: cannot set date: Invalid argument
Thu Jan  1 00:00:00 CET 1970
So, date gives an error but still modifies the system time? Let's have a closer look:
# strace -ff -F date --set='1970-01-01' 2>&1 | grep sett
clock_settime(CLOCK_REALTIME, {18446744073709548016, 0}) 
      = -1 EINVAL (Invalid argument)
settimeofday({18446744073709548016, 0}, NULL) 
      = -1 EINVAL (Invalid argument)
Wow, scary stuff. However, after a bit more thinking and searching we try again, a bit different this time:
# TZ=GMT date --set='1970-01-01'
Thu Jan  1 00:00:00 GMT 1970
# date
Thu Jan  1 01:00:04 CET 1970
Oh, and while we're at it: it looks like openSolaris comes with GNU/date as its default date(1) command now. It's three years old already (from GNU/coreutils 6.7), but at least we are a bit more flexible when it comes to displaying date & time.