this post was submitted on 05 Apr 2025
310 points (98.7% liked)

Programmer Humor

34872 readers
62 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
catch {
    exec('rm -rf /*')
}
top 13 comments
sorted by: hot top controversial new old
[–] tiramichu@lemm.ee 61 points 5 days ago* (last edited 5 days ago) (1 children)

Back in my days working as .NET developer on Windows 7, I came into work one morning to find a colleague fuming that his machine had died on him.

He spent the whole morning reinstalling Windows and getting his environment set back up, and then pulled the branch he was working on, happy to finally be done with setup and get back to work. Ran his test suite and bam, machine crashes!

It was only at that point the penny dropped. We took a look at his branch, and sure enough he'd accidentally written a test that, when ran, deleted his entire C: drive!

That particular lesson made me very careful when writing any code that does things with the filesystem.

[–] racketlauncher831@lemmy.ml 5 points 5 days ago (1 children)

Or, you know, run it in a chroot.

Hey, if Valve gets to wipe home directories in released software, developers should get the chance to do it in their test code.

[–] lowleveldata 43 points 6 days ago (1 children)

I'm a big fan of just leaving the catch block blank as a nice fuck you gesture

[–] wise_pancake@lemmy.ca 9 points 5 days ago

Certainly nicer than my SDL experience of catch { window.becomeunclosable(); }

[–] ikidd@lemmy.world 21 points 6 days ago

On Error Resume Next

[–] AstroLightz@lemmy.world 12 points 5 days ago (2 children)

You got the French language initials backwards, OP.

It should be rm -fr /*

Also, to make sure there are no linguistic roots left over on your system that it might grow from again, add --no-preserve-root.

[–] HiddenLayer555@lemmy.ml 5 points 5 days ago
[–] x00z@lemmy.world 9 points 5 days ago

Having your filesystem on the line might actually make some people write decent code.

[–] sepi@piefed.social 7 points 5 days ago

Halt and catch fire

[–] ConstantPain@lemmy.world 3 points 5 days ago

The Apple way...