I thought I was so clever

A while back, I built a little emacs + shell hack to prepare attachments for MH. The usual borkage applied…

When I moved my hack to a Solaris box at my institution during testing, it didn't work; turns out they didn't have an /etc/mime.types file installed. So I put code in the shell script to use a personal copy if needed.

Later, I got annoyed that the whole thing lost horribly whenever the file extension of the attachment wasn't in the mime types file. So fixed it to default to "text/plain".

Tonight I noticed that all my attachments on the Solaris box were "text/plain". So I went to investigate, and discovered that someone had installed an /etc/mime.types on the box. With exactly one entry.

All my cleverness had combined to keep the attachment toy from failing, and instead to give not-obviously-wrong answers. Heaven knows how many PDF files I've sent out recently with mime-type "text/plain".

:( I made the script ignore /etc/mime.types on the Solaris box, obviously, which fixed the immediate problem. But now I'm not sure what I want the default behavior of the script to be. Should it try to be cleverer about finding a mime type, perhaps by looking in each of the mime type files in turn for a solution? Or should I just make it simple, and make it crash when it loses—cleverness being what got me in trouble in the first place?

If you're one of those who constantly complain about software reliability, just keep in mind that half the battle is figuring out what the right specification is in the first place. (B)