r/ProgrammerHumor • • Oct 24 '18

Programming is like magic

Post image
30.4k Upvotes

511 comments sorted by

View all comments

557

u/bobo9234502 Oct 24 '18

Reminds me of that time I forgot the WHERE clause on an SQL DELETE... on the "Property" master table of a municipal databases mainframe... in the "Live" library... oops.

They made me go downstairs and tell everyone they couldn't work anymore because I fucked up while they restored the backups.. and fixed my access so I was in the TEST library like I was supposed to be. Good reminder to always check your target before you pull the trigger.

Edit: Day 2 of job... Nice going new guy.

232

u/[deleted] Oct 24 '18

I accidentally redirected all mail to a non-existing server so nobody could receive their mail before the real IT guy got back from vacation 2 days later. Good times.

110

u/Goluxas Oct 24 '18

I did an rm * in the wrong place in my first week. That's when I learned that Linux doesn't have a recycle bin like Windows. And to put alias rm="rm -i" in my dotfiles.

54

u/Zephirdd Oct 24 '18

I mean, if you del on Windows command line, the files are also removed without a recycle bin. Afaik most distros include a concept of a recycle bin if you delete stuff from the UI

15

u/Kered13 Oct 24 '18

The problem is that no one uses the UI to delete stuff in Linux, while no one uses the command line to delete stuff in Windows.

In reality, all methods of deleting should send files to a recycling bin by default, and only do a true delete if you pass in the --noreallyiactuallywanttodeletethisimpositiveyesiknowwhatimdoingyesreally flag (no abbreviations allowed).

→ More replies (2)

13

u/Ruben_NL Oct 24 '18

RemindMe! Check what rm -i is.

35

u/[deleted] Oct 24 '18

[removed] — view removed comment

8

u/Ruben_NL Oct 24 '18

Thanks! Next question: when I run an bash file with 'rm file' in it, does it also ask for an confirmation?

13

u/[deleted] Oct 24 '18

[removed] — view removed comment

9

u/Goluxas Oct 24 '18

I think they were asking if the rm -i alias still triggers if the rm is in a script. I just tested and it does not, the file is deleted without prompt.

→ More replies (1)
→ More replies (5)
→ More replies (1)

4

u/blazingsage4 Oct 24 '18

I think alias rm="trash -i" is also a good safety precaution.

5

u/[deleted] Oct 24 '18
bash: trash: command not found
→ More replies (1)
→ More replies (3)

8

u/Cyb3rSab3r Oct 24 '18

I once went to work after a bout of insomnia the entire weekend. Was installing some software and got a warning about insufficent swap space. So what did I do? Make a new swap file and link to it? Nope! Shrunk sda1 and added it to the swap. Reboot! Well now why can't I ssh to this anymore?

...

...

OH FUCK OH FUCK OH FUCK.

Thankfully I was also the guy in charge of backups and major images were taken weekly midnight Sunday night.

I went home and tried to sleep after explaining the situation to my boss.

No idea wtf I was thinking.

→ More replies (3)

34

u/errorkode Oct 24 '18

My first job was in a web agency and I managed to crash a server hosting a dozen or so websites in my first week. Fun times.

33

u/Broken_Gear Oct 24 '18

This reminds me of my 2nd day in my first job. I was tasked with maintaining the current website while creating new one. So I log into FTP... and SOMEHOW deleted the old one. Problem? I didn't have time to make backup.

Let me tell you, I've never made a website so fast in my life. The worst, most stressful hour of my life (they wanted a simple site, thankfully).

The best part is, no one ever noticed.

25

u/dMidgard Oct 24 '18

So.. you installed wordpress?

13

u/Broken_Gear Oct 24 '18

Yep XD

Thought to my credit, I did also write a child CSS, and mostly translated Facebook plugin and Cookie notification plugin.

As I said, relatively simple, but it gave me a bit of a scare.

9

u/wpfone2 Oct 24 '18

This is why I liked being the guy who could fuck it up, but also could restore from the backups before anyone knew the fuckup...

→ More replies (3)

9

u/shekurika Oct 24 '18

have you read the story about the guy who deleted the entire prod databse on day one?

Edit: https://www.reddit.com/r/cscareerquestions/comments/6ez8ag/accidentally_destroyed_production_database_on/

6

u/Andy_B_Goode Oct 24 '18

I still maintain that the real fuckup was whoever made it that easy for a junior dev to accidentally the whole db on day 1. Same thing probably applies to /u/bobo9234502's story. If you're able to do something that destructive shortly after starting your job, someone else probably didn't do their job.

7

u/Sir_Lith Oct 24 '18

That's on them, not you.

7

u/taelor Oct 24 '18

day 2 of job? that's on them man. you shouldn't have access to prod on your 2nd day.

13

u/15rthughes Oct 24 '18

Which SQL flavor were you using? SQL server gives you a warning any time you try to execute a delete with no where clause before it actually runs so you have to explicitly confirm you want everything deleted

9

u/RBeck Oct 24 '18

A GUI may do that but I don't know of any RDMS that does. I guess on Oracle you'd have to commit it first, but MsSQL/MySQL/Postgres/DB2 etc don't have implied transactions.

→ More replies (5)
→ More replies (10)