Live data from Hacker News

Ooops.

github.com

111–120 of 247 posts

Re: Ooops.

#111

Earlier quoted context omitted.

and the entire windows directory, and the entire users directory, and ...

It was only deleting /usr, which doesn't contain home directories or config files. I suppose that /usr does store a good chunk of what the Windows directory has in it though.

In other Unix flavors, /home may be an alias to /usr/home.

Re: Ooops.

#112
post #90

Earlier quoted context omitted.

If it wasn't obvious, "Why is `rm -rf` not connected to the recycle bin?" is implicit in my original question.

You're operating at a layer below where a trash can makes sense. Pretend that this command had moved everything to a trash can. The command to move the files out of the trash can now resides in the trash can, where it isn't being very useful. It's still possible to recover the files, but then again, it's also still possible to recover the files you deleted with rm. rm is on the same layer as the DOS del command. Neit…

it's also still possible to recover the files you deleted with rm.

If you're lucky and didn't write too much to the hard-disk after deletion, yes, but with a recycling bin you have much higher chances of recovery.

Regarding `del` in DOS: You're the second one to bring up that analogy. I don't see how this is relevant. Just because Windows does it that way doesn't mean that it's good.

Re: Ooops.

#113
post #36

Earlier quoted context omitted.

A double edge knife/sword?

"Double-edged sword" has never worked for me, as a cliche. Do you often find yourself inadvertently smacking against the dull side of a single-edged sword, such that you stay away from double-edged swords for your own safety? rm is like a double- ended knife, i.e.: http://image.shutterstock.com/display_pic_with_logo/4253/425... (Fun fact: many knife throwers grip the blade end anyway, rendering the cliche to an even…

This is completely unrelated to the original topic at hand, but I thought it might be interesting to shed some light on knife throwers' grips. For a given thrown weapon, whether a knife or an axe (or anything else that is meant to spin end-over-end), the number of revolutions is roughly fixed and is a function of the distance from the thrower to the target. Thus if you happen to be at a distance where you're getting a half revolution, you'll throw from the knife blade, or turn the axe around (so it's pointing towards you on throw). That enables it to hit the target the right way around. Of course, many people prefer to take a half-revolution step forwards/back so that they can throw from the tip regardless, just as a matter of form -- I did this for a while, although I feel I get better control when throwing from the handle.

Re: Ooops.

#114
post #109
post #89

Earlier quoted context omitted.

That's what I thought. I'd be happy if anyone chimed in with a legitimate reason, but I won't be surprised if the lack of a recycling bin is just one more symptom of the Linux developer community's apathy towards the actual human beings who use their software.

I would speculate that it is a historical reason. It's no secret that the Unix environment was not designed for personal use in homes, but on mainframe time shared computers inside universities and businesses. Space was limited, and just moving files to another location to deal with later added unnecessary steps to a process that didn't have much of a benefit, at the time. As space has become less valuable on compute…

there is no need to recreate the functionality at a lower level.

I refer you to the original submission.

Re: Ooops.

#115
post #84

Earlier quoted context omitted.

Over the years I've been steadily training myself to type "WHERE" earlier in the process, until I have finally settled on the obvious-in-hindsight solution: Always simply start with the WHERE clause. (Of course every effort not to be on the SQL shell of a production server in the first place should be taken, but sometimes you need a sledgehammer and nothing else will work.)

The habit I learned was: before running any DELETE or UPDATE statement, run a SELECT with the same WHERE. (e.g. if I meant to say DELETE FROM puppies WHERE cute = 0, first run SELECT FROM puppies WHERE cute = 0.) I find I remember to do that because of the direct benefit (getting a sneak preview of what I'm going to delete), but it also means I end up thinking twice about the WHERE statement, so I'm much less likely…

I'm a couple of levels more paranoid than that. First, I'll write the DELETE as a regular SELECT (to preview number of rows), then turn it into a SELECT INTO to save the soon-to-be-deleted rows into a table with a backup_date_ prefix (So old backups can be deleted occasionally). Next, before changing anything, I wrap the statement in a BEGIN TRAN, and ROLLBACK TRAN. After all that, I will finally modify the SELECT INTO into a DELETE statement, run it once while wrapped in the transaction (to verify that the number of rows modified hasn't changed), and then finally run without the transaction to delete the rows. Overkill?

Re: Ooops.

#116
I only recently discovered molly-guard:

http://packages.debian.org/sid/molly-guard

which prevents you from running halt/shutdown etc. via SSH without first confirming the hostname.

I've done that before with pretty traumatic consequences, so it's now on my list of must-have's for any important remote box.

http://www.catb.org/jargon/html/M/molly-guard.html

Re: Ooops.

#118

Perhaps because I'm not a GitHub user, and because I've only ever peeked at HNers' GitHub accounts, but I was always under the impression that given the nature of the service, it would have an early-days-of-HN feel wrt to user behaviour. It was a little disheartening to see the number of Reddit-esque comments that are simply a couple of words along the lines of "omfg" and a constant stream of meme abuse. I expected b…

It's like reading Youtube comments--not for the faint of heart. And the jab at reddit from the HN pedestal is probably misguided... reddit used to be more like HN, and HN is becoming more like the bad parts of reddit every day. Every site tends toward Youtube level comments as time passes, and the people who don't like it eventually jump ship to a new site, and then the process repeats itself.

"And the jab at reddit from the HN pedestal is probably misguided... reddit used to be more like HN, and HN is becoming more like the bad parts of reddit every day."

But you just did the same thing...

Re: Ooops.

#119
post #101

Earlier quoted context omitted.

Even if it did, you wouldn't use it in this case. Windows batch files delete files outright too, instead of sending them to the recycling bin. You don't want to have to depend on the user to clean up after your automation.

You don't want to have to depend on the user to clean up after your automation. I don't see what's the big deal is. Once in a while when the recycling bin gets too big, the user can empty it. Or you can have a scheduled operation that deletes stuff after 30 days.

> Once in a while when the recycling bin gets too big, the user can empty it.

Many Linux systems don't even have a regular "user". They just sit in a corner and serve webpages, or do other tasks silently.

> Or you can have a scheduled operation that deletes stuff after 30 days.

Why not just keep backups for 30 days?

Re: Ooops.

#120
post #84

Earlier quoted context omitted.

I hate that feeling you get in the pit of your stomach after you realize what's happening. Same thing when you forget the WHERE on a DELETE FROM.

Over the years I've been steadily training myself to type "WHERE" earlier in the process, until I have finally settled on the obvious-in-hindsight solution: Always simply start with the WHERE clause. (Of course every effort not to be on the SQL shell of a production server in the first place should be taken, but sometimes you need a sledgehammer and nothing else will work.)

I always (with sql server at least) add a begin tran/commit/rollback before any prod statements, because of getting burned in the past.

Even if you add the WHERE, but put it on a second line and only run the first, the transaction will help...

Of course, if it's going to lock the data, do all of the statements together: BEGIN TRAN UPDATE ... WHERE ... SELECT ... WHERE .... -- show that the update worked ROLLBACK

Then run the actual statement

Post reply on HN