this post was submitted on 01 Oct 2025
640 points (99.4% liked)

Programmer Humor

26688 readers
2837 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] RustyNova@lemmy.world 13 points 3 days ago (2 children)

Well it's not that simple... Because whoever wrote that made it way too complicated (and the production version has been tweaked without updating the dev too)

A clean rewrite with some guard clauses helped remove the haduken ifs and actually zipping the file outside of the zipped directory helped a lot

[–] r00ty@kbin.life 6 points 3 days ago (1 children)

I mean, I have to say I've hastened my own demise (in program terms) by over-engineering something that should be simple. Sometimes adding protective guardrails actually causes errors when something changes.

[–] Croquette@sh.itjust.works 1 points 5 hours ago

Which are what guardrails are for. When something change, you don't know the impact the change will have.

By having guardrails, you make sure to limit/eliminate potential critical issues.

[–] Quantenteilchen@discuss.tchncs.de 2 points 3 days ago (1 children)

Am I understanding that last part correctly?

[...] and actually zipping the file outside of the zipped directory helped a lot

Did they just automatically create a backup zip-bomb in their script‽

[–] RustyNova@lemmy.world 8 points 3 days ago

I oversimplified it but the actual process was to zip files to send to an FTP server

The cron zipped the files to send in the same directory as the zipped files, then sent the zip, then deleted the zip

Looks fine, right? But what if the FTP server is slow and uploading take more time than the hourly cron dispatch? You now have a second script that zip all the folder, with the previous zip file, which will slow down the upload, etc...

I believe may have been started by an FTP upload erroring out and forcing an early return without having a cleanup, and progressively got worse

... I suppose this happened. The logs were actually broken and didn't actually add the message part of the error object, and only logging the memory address to it