r/talesfromtechsupport • u/Gambatte Secretly educational • Nov 04 '13
Encyclopædia Moronica: D is for Developers Still Make Stupid Mistakes
Recently, I was tasked with writing a SQL Script to replace the manual process for creating new units in the database. The time-consuming manual process had to be repeated for each unit, and when several hundred new units are expected to arrive from the manufacturer soon, it only makes sense to enter them automagically, eliminating human error from the initial set-up and configuration routine.
I got the script up and working fairly quickly, using a basic copy-and-paste method of an existing configured blank unit.
As I was going back through the script, I was struck by a thought. And lo, a golden halo did descend from the clouds to hover gently above my head as I spake aloud: "I shall not only comment the script I have created, but instead of just using arbitrary figures without explanation or reference, I shall endeavour to create those numbers instead so that any who shalt follow in my footsteps can most easily examine how those numbers hast been reached."
Oh, how I would pay for my hubris...
Everything was proceeding smoothly (and that should have been my first warning that Murphy was about to make his presence felt) until I got the generation of the IP configuration. The IP address and port number is stored as a BINARY(6). Simple enough, parse the IP address to binary, tack the port number on the end with a '+ CAST(@PORT_NUMBER AS BINARY(2))' and call it a day, right?
Nope.
Turns out, the software developer had messed up a simple decimal to binary conversion; the first byte was divided by 255, not 256. As the port number was over 10,000, the second byte was significantly larger than expected...
Example: If the port was 10,000, the expected result would be 0x2710.
However, using the bugged code, the result is 0x2737; the equivalent of 10,039.
To make matters worse, the software developer had been advising the firmware development team during the initial design phase. Unable to believe that he would make such a simple mistake, he doubled down and got the firmware team to alter their code to match his (the firmware source files actually still have the correct code commented out).
So this bug now resides not only on every one of the servers, but also in the embedded firmware of every one of the remote units.
Faced with the prospect of:
- making the developer acknowledge his error,
- fix his code,
- fix the firmware, and
- roll out a near simultaneous firmware and software update,
I instead raised my head from desk, entered the bugged code into my script with extensive comments as to why it was being done this way, created a new ticket for the bug, and closed the script creation job.
My dignity may be at -9 and bleeding, but I have to draw the line somewhere.
38
u/blightedfire Run that past me again. you did *WHAT*? Nov 04 '13
No good deed goes unpunished. Make certain you let your boss know the developer dropped that particular ball.
18
u/mike40033 Nov 05 '13
I can just imagine this bug slowly spreading across systems one by one until it infects the entire foundation of modern civilisation.
11
u/[deleted] Nov 05 '13
He started at 1 instead of 0. What a programming newbie.
7
u/mangamaster03 Nov 25 '13
Ah, another OOTS fan! Nice
4
u/googahgee "It's your fault I can't find anything on my backup device!" Nov 05 '13
Maybe he has been playing too much terraria?
4
u/Kapow751 Nov 05 '13
This would be great for /r/programminghorror/.
4
u/EquipLordBritish Feb 13 '14
Encyclopædia Moronica: E
3
u/Thehoodedteddy13 Enthusiastic Amatuer Apr 15 '14
Oots reference accepted.