[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

The dumb things we do to ourselves.



Be careful what you wish for.  Today I decided, instead of doing my
homework, that I was going to start learning mutt.  I normally localize
my system to es_ES, but this makes the default key bindings not make
sense when I look at a UI in Spanish.  I decided to whip up a two line
shell script called mutt:

#!/bin/sh
LANG=C mutt

I placed in ~/bin, which ordinarily, would not be a problem.  The
problem came with this:

$ echo $PATH
/home/sanchezr/bin:/home/sanchezr/bin:/usr/local/bin:/opt/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

This way, when I typed `mutt' at the command line, I would hit the `mutt'
in ~/bin and not the one in /usr/bin.  Naturally, since I did not
specify an explicit path to the `mutt' in my script, my invocation
caused a fork to execute mutt, which happened to be the shell script, since
it was before the binary in /usr/bin.  Imagine my surprise when it
fairly locked my machine up and consumed all my memory (1 GB) and swap
(another 1 GB) in about a minute with fork after fork racing to execute
the `mutt' in ~/bin.

I fixed the script like this:

#!/bin/sh
LANG=C /usr/bin/mutt

Hopefully, someone gets a chuckle out of this.

-Roberto

-- 
Roberto C. Sanchez
http://familiasanchez.net/~sanchezr

Attachment: signature.asc
Description: Digital signature


Reply to: