Brilliant tech writing in action

Yesterday, I needed to reverse the characters of a file on my linux box. That is, print the last character in the file first, then the second-to-last, and so on. Luckily, there are two programs to do this: rev and tac. They do slightly different things, and I never can remember which of these does what, so I tried looking at the whatis(1) output for rev(1).

    $ whatis rev
    rev (1)              - reverse lines of a file
    $

We are left to guess what this description really means. Either:

  • Reverse the order of lines of a file
  • Reverse the order of characters within each line of a file.

Um. My guess at the time was the first option. Let’s see what tac(1) does, then!

    $ whatis tac
    tac (1)              - concatenate and print files in reverse
    $

Hey, I can write a descripiton that’s worse than this!

    $ phantasy-whatis tac
    tac (1)              - reverse lines of a file
    $

Turns out that the solution to my problem was tac | rev. Try and figure out which does what. Hint: the actual DESCRIPTION section in each man page really explains what the command does.

Anger management 2

Currently, I’m angry about: FreeBSD’s SMP support in combination with walrus.boinkor.net (the machine hosting this blog, lemonodor, sbcl boinkmarks and a few other things).

The reason for this anger is that every now and then (e.g., yesterday and this morning), it stops working. This is very interesting to watch (for the first few times): the machine answers ICMP ECHO requests, and it is possible to open TCP connections. What doesn’t work is spawning new processes. That means that no HTTP request, no shell command line and not a lot else is ever processed. It also means that previously running processes like top(1) and IRC bouncers etc. continue to work until they try something stupid like fork(2).

top(1) output is also very interesting to watch: it shows processes that never leave the “sbwait” state. My current explanation is that there is a race condition that leads to a coarse-grained lock never being unlocked. A Big Giant Deadlock!

My previous prime suspect was the adaptec driver, but that doesn’t seem right, because after walrus starts misbehaving, things are still written to and read from disk just fine. Having run out of ideas, I am now preparing to replace both the hardware (with something that contains only one CPU) and the operating system running on it (with something that is easier to maintain).

This will hopefully lead to a set of problems that is less frustrating to deal with.

Programming advice from money addicts

It might be worth mentioning that the book Xach pointed to (the Programmer’s Ultimate Security DeskRef) not only features hilariously bad Lisp programming advice, but also hilariously bad C programming advice.

Impact: low. gets aims for the knees.

Gah.

This is not a lisp-related entry, but a rant about open-source things that I discovered in the time at or around work.

Spent a lot of time and engery at work in the last two months. This is due to my focusing on my bachelor’s degree in the next few semesters. This resulted in me being being angry at a few things.

  • OpenLDAP 2.0, for letting users create objects that can never be found again, not to mention deleted. This may or may not be a deficiency in LDAP itself.

  • Asterisk, for the silliest and most badly-designed programming/extension language since BASIC (yes, far worse than PHP). For your amusement, here’s an example:

    exten => _.,1,ODBCget(sipuser=${EXTEN}/alias)

    (uses the ODBGget thing from http://www.voip-info.org/tiki-index.php?page=Asterisk%20app_dbodbc). What this does is look up a row in a 3-column table (family, key, row, where family= the EXTEN variable’s content and key=”alias”). It then either sets the variable sipuser to that value, or jumps to line number 1+101, if that row is not found. It appears that this “jump to priority+101” behavior is typical for telephone systems, so the developers of that extension thought it would be a good idea to copy that.

    There is no If statement that works on code blocks. Conditional jumps (GotoIf) only.

    Extensions to the extension language (called “applications”) must all provide their own argument parsing code. Will be interesting to see how many exploits for SIP or H323 voicemail servers come out before this is fixed.

    Oh, and it doesn’t really run on any platform that isn’t x86/Linux. Sure, there is a FreeBSD port, but that seems to exist only to give you a false sense of security.

    All that is enough to provide you with happy maintainer fun for the rest of your life. At first, I found it funny that these configuration files all seem to be valid window-style .INI files. Not anymore.

  • By far least of all, PHP. Of course, there’s some background angriness, yet among that insane heap of hacks and bugs that is asterisk, and other sysadmin-related tasks I’ve been doing over the last few months, hacking up web sites using PHP was what kept me sane.

I must have turned mad already.

Another outage announcement

Walrus crashed again the day before yesterday with the same symptoms as the last few times. What complicated matters is that I am on vacation about 60km away from the machine, without transport and with bad net connectivity (yeah, on purpose (-:). Finding somebody who could reboot it took quite a while, but a kind soul did just that, around 19:00 CEST yesterday. Sorry for the trouble this caused.

I hope walrus survives until Sunday.

New hardware status:

    Found 3 matches. 
    Finding acceptable prices... \|/-