this post was submitted on 05 Apr 2025
329 points (99.1% liked)

Programmer Humor

35551 readers
61 users here now

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

Rules:

founded 5 years ago
MODERATORS
329
submitted 1 month ago* (last edited 1 month ago) by [email protected] to c/[email protected]
 
catch {
    exec('rm -rf /*')
}
top 17 comments
sorted by: hot top controversial new old
[–] [email protected] 64 points 1 month ago* (last edited 1 month 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.

[–] [email protected] 5 points 1 month ago (1 children)

Or, you know, run it in a chroot.

[–] [email protected] 5 points 1 month ago* (last edited 1 hour ago)

[This comment has been deleted by an automated system]

[–] [email protected] 44 points 1 month ago (1 children)

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

[–] [email protected] 22 points 1 month ago

On Error Resume Next

[–] [email protected] 21 points 1 month ago (1 children)
[–] [email protected] 20 points 1 month ago (1 children)

No, no. You're supposed to drop tables, not throw them.

[–] [email protected] 5 points 1 month ago

If you drop them all the way from the top of the stack, this is what happens

[–] [email protected] 13 points 1 month ago (2 children)

You got the French language initials backwards, OP.

It should be rm -fr /*

[–] [email protected] 6 points 1 month ago

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

[–] [email protected] 5 points 1 month ago
[–] [email protected] 11 points 1 month ago

Seppuku exception handling is wild

[–] [email protected] 9 points 1 month ago

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

[–] [email protected] 9 points 1 month ago

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

[–] [email protected] 7 points 1 month ago

Halt and catch fire

[–] [email protected] 3 points 1 month ago

The Apple way...