I’m Aware My Code Is a Sad Affair
I was recently asked to hunt a bug in some of my old code. It was a shell script generating Postscript, generating .PNG files for a website. It had “organically” grown over some years and started generating bad Postscript starting May 1st. Since Postscript is well designed and has good error handling, it did not take long to find the problem. The word
May had not been replaced by a
120 (the year day number of May 1st). Here is a sniped:
Note the ‘r’ that should be a ‘y’ in the center LOC. My bad. However, I realized that, in theory, this error could have been caught (by sed) because the second
/[Mm]ar[^ ]*/ would not ever be satisfied. Sadly, I can’t make sed find my bad code, but I can dream, can’t I?