The mysteriously deleted file
-
For our remote embedded system, we have a convoluted patching mechanism. For our latest release, to solve another problem with large archives I rewrote our unzipper. It worked great except a critical file would get deleted. We threw more logging, changed the organzation of the zip files to no avail. Another developer added some logging which identified when the file in question was getting deleted and asked me what circumstances led to that error condition. I looked over his shoulder, my eyes went up a few lines and I saw it. To take care of a very rare edge case, I added a check. Problem is that if the file being unzipped was exactly the same size as the unzip buffer, that check would erroneously fail. To make it worse, I realized that the check would have never failed (aside from the above) unless the zip file was deliberately corrupted, including adding fake CRCs and even then it would be very difficult. Point being, I added a test for an edge case that would never happen causing an edge case that did!