Back in February I updated Chat-O-Matic to include a "feature" that turned out to be a bug. It was an incredibly sublime bug and I spent a lot of time tearing my hair out over it. The bug manifested itself in three ways:
- The admin name stopped changing on EXP IV
- The admin stopped harassing the top player
- The "feature" never worked worth a damn
I only looked into the first problem, which was incredibly annoying. You might recall that "Eddy" was the admin on EXP IV for a long, long time. It changed once or twice when I was debugging, but I could never make it change automatically.
So WTF happened?
I broke all the functions dealing with score-tracking when I added the new feature. The aim was to kick the bots into high gear whenever a player (assumed to be a cheatz0r) had a lead of half the winning score over the next highest player. There was already a variable called HISCORE and I added another variable named 2NDHI to calculate the point spread, like so:
PSPREAD=$((HISCORE - 2NDHI))
I suppose anyone who knows BASH sees the error and here we get into the difference between RTFM (Read The Fucking Manual) and UTFM (Understand The Fucking Manual).
You can RTFM and never UTFM a lot when it comes to Linux.
It turns out a variable name cannot begin with a number.
I did not know that!
And nowhere in the BASH manual does it explicitly say "You cannot have a variable that begins with a number".
But it does say that "[n]" is interpreted as a file descriptor. Every time the interpreter ran across "2NDHI" it spit out a "command not found" error.
I changed "2NDHI" ti "HI2" and everything worked fine again.
Sixteen years banging away at Linux and I never knew that.
Post a Comment