Spelling Matters

I consider myself a pretty good speller. I recognize that not everyone puts the same degree of emphasis on correct spelling as I do. Nevertheless, I think that if you’re going to write something that will be viewed or used by the public, then you should make sure it’s correct. This applies especially to program code. Read on for some fun.

I’ve been trying to get Cacti to graph ZFS statistics like read/write bytes and ops, and space usage. I’ve got a custom script that gets the stats, indexed by zpool name, similar to what you get with an SNMP query. To integrate this into Cacti, I have to provide an XML description of how my script query works and what its output looks like. No biggie, right? I thought so. I got all the pieces in place and looked at the results. There were three indexes for the host, corresponding to the three ZFS pools configured there. But the names were missing.

Well, as it turns out, there’s a wrinkle. One of the standard pieces of the script query XML syntax is the output delimiter. Since the script query uses colons, I did

<output_delimiter>:</output_delimiter>

Yes, there are two “i”s in “delimiter”, as you can see in the dictionary. The root of the word is “limit”. I am not aware of any variations in its spelling. Note how it is spelled in the manual. That’s not just a typo in the docs… it’s in the code too:

if (preg_match("/(.*)" . preg_quote($script_queries["output_delimeter"])

That’s an excerpt from lib/data_query.php in version 0.6.8h.

The end result is that my well-formed XML document was nevertheless being misread by the code, failing to find the output delim-E-ter, and not splitting the output properly. Once I “fixed” my XML, everybody was happy. But that’s 30 minutes of my life I’ll never get back.

Spelling is doubly important if you’re writing code to match what others will write!

Back to top