News for hackers. Stuff that matters.
Re:Count to ten when a plane goes down by bonaldi on Monday July 21, 2014 @07:34PM (#8066645)
The world where you know you that a) you have an incredibly powerful key with no safeguards at your fingertips and b) you might be in a breaking news situation and nonetheless you go for the key right next to the dangerous one carelessly enough that you miss?

Think about it: Unix is equally as "insane". If you're the guy on the console who meant to clean out some crap dir and accidentally typoed "rm -rf /" and then caused an international crisis you're going to get fired too.

Then years later HN will call for Dennis Ritchie to get fired instead.

Re:Count to ten when a plane goes down by megablast on Monday July 21, 2014 @08:13PM (#8066792)
Also, the situation where somebody has to be fired.

I imagine that someone wanted someone's head, so whose head should it have been? They guy who wrote the system couldn't be fired, he was in a different company. And maybe a macro has been assigned to that key, so it wasn't his fault anyway.

Re:Count to ten when a plane goes down by colanderman on Tuesday July 22, 2014 @10:40AM (#8069204)
The person in charge of minimizing risk to their internal systems.

Unfortunately, most small companies have no-one who fills that role, or if they do, it's the same person who both has the power to fire others, and is unwilling to entertain the notion that they themselves are at fault.

Re:Count to ten when a plane goes down by kstenerud on Tuesday July 22, 2014 @10:10AM (#8069044)
The worst unix disaster I ever saw happened to one of my co-workers. He was working on a client machine, logged in as root because he needed to compile and install some complicated software. As he was working, he did an ls -l /bin and copy-pasted it to a text editor so he could make sure everything was installed correctly. Unfortunately, after returning to his console, he accidentally hit paste. Most of /bin was actually symlinked somewhere else. As you know, ls shows symlinks like this:

lrwxrwxrwx 1 root root 20 Apr 27 17:02 cc -> /etc/alternatives/cc

Guess what happens when you paste a whole list of those into a console as root?

Re:Count to ten when a plane goes down by lcedp on Tuesday July 22, 2014 @12:15PM (#8069726)
That's fascinating.

To prevent this from happening with me, I've added the following line to my `.Xdefaults`

    URxvt.perl-ext: confirm-paste
(I'm using `rxvt-unicode`)

http://i.imgur.com/joHRXaH.png

Re:Count to ten when a plane goes down by talmand on Tuesday July 22, 2014 @10:38AM (#8069191)
The worst unix disaster ever? Could you elaborate for non-unix people such as myself?
Re:Count to ten when a plane goes down by smwht on Tuesday July 22, 2014 @10:59AM (#8069313)
The important character here is the '>'. This redirects output to a file and overwrites the file. The lrwxrwxrwx will only print an error, but the redirect to the target executable will erase the target.

For example:

  $ echo "asdf" > foo
  $ cat foo
  asdf
  $ lrwxwrwxrwx 1 root root -> foo
  lrwxrwxrwx: command not found
  $ cat foo
  $
So basically, this zero'd out every executable on the system.
Re:Count to ten when a plane goes down by talmand on Tuesday July 22, 2014 @11:24AM (#8069450)
Yep, that's bad.

Out of curiosity, what was the solution to fix all that?

Re:Count to ten when a plane goes down by mianosm on Tuesday July 22, 2014 @11:50AM (#8069592)
Possibly a cp or an scp from a remote system with a working set of binaries.
Re:Count to ten when a plane goes down by kstenerud on Tuesday July 22, 2014 @11:58AM (#8069641)
scp was in /usr/bin, so we could at least copy enough basics from another system and recover the rest from a backup. Needless to say we lost the client contract.
Re:Count to ten when a plane goes down by Tyr42 on Tuesday July 22, 2014 @10:42AM (#8069210)
Oh no, that redirect!
Re:Count to ten when a plane goes down by nmjohn on Monday July 21, 2014 @07:38PM (#8066662)
Except he didn't know there was a breaking news situation. He said pushing the wrong button wouldn't normally be a big deal.
Re:Count to ten when a plane goes down by bonaldi on Monday July 21, 2014 @07:42PM (#8066682)
He said he came in to find the system running, and the only time that happened was when Washington was waiting for info.

And even if you don't buy that, if pushing the button's not a big deal it doesn't need all the safeguards everyone's yelling for. (Had such safeguards been in place he might equally well have seen them, thought "oh, nobody's in, this will do what I want anyway" and approved it).

Re:Count to ten when a plane goes down by vacri on Monday July 21, 2014 @08:03PM (#8066760)
That button needs a safeguard even if it's not an international incident. Even if only one person would lose a few hours' work from an all-nighter, work for something that's not so important, it's still someone's work.

And given that it's right next to a 'single terminal reset' key, it should be immediately obvious to anyone who's ever used a keyboard - mistakes can and do happen, even when you're fluent.

Re:Count to ten when a plane goes down by coldpie on Tuesday July 22, 2014 @08:27AM (#8068543)
And yet, to this day, Firefox has both Ctrl-Q (close all Firefox windows without prompting) and its neighbor Ctrl-W (close current tab) and refuses to change that or provide remappable keyboard shortcuts. One of the biggest UI failures I'm aware of in 2014.

https://bugzilla.mozilla.org/show_bug.cgi?id=52821

Re:Count to ten when a plane goes down by hrjet on Tuesday July 22, 2014 @09:04AM (#8068712)
This in combination with "Restore all tabs on startup" not being the default is a disaster.

The first thing I do on a new Firefox installation is enable "Restore all tabs on startup".

Re:Count to ten when a plane goes down by hack_37 on Tuesday July 22, 2014 @09:46AM (#8068929)
Even without that flag enabled, you can restore all tabs when closing/reopening Firefox. History > Restore Closed tabs.
Re:Count to ten when a plane goes down by hrjet on Tuesday July 22, 2014 @09:54AM (#8068968)
Thanks, good to know.
Re:Count to ten when a plane goes down by schnable on Tuesday July 22, 2014 @10:01AM (#8068997)
This is in all apps in OS X, that's the standard keymapping.
Re:Count to ten when a plane goes down by noisy_boy on Tuesday July 22, 2014 @09:30AM (#8068833)
Ctrl-Q exits on Thunderbird too. Since in MS Outlook that combination marks a mail as read, for keyboard-heavy users switching between the two, it is no fun.
Re:Count to ten when a plane goes down by iancarroll on Monday July 21, 2014 @07:51PM (#8066720)
One might wonder if that workstation showed the online and offline status of all the computers.
Re:Count to ten when a plane goes down by pjc50 on Tuesday July 22, 2014 @06:42AM (#8068230)
Many years ago I wrote a kernel module for my own use in response to a similar incident. It checked to see if the calling process was deleting a file called ".landmine" and killed the calling process if it was.

Far from perfect - it depended on the order of deletion - but a more general solution than preserve root. Of course it still requires the user to mark things they consider "important".

Re:Count to ten when a plane goes down by baddox on Monday July 21, 2014 @07:52PM (#8066727)
But typing "rm -rf /" is significantly harder to do accidentally than typing F7 instead of F6.
Re:Count to ten when a plane goes down by graylights on Monday July 21, 2014 @08:05PM (#8066764)
Not really, a lot of novice unix users are of the habit of removing files with -rf switch. I cringe everytime I see it.

The command "rm -rf ~/blue/" is just a single space key from being equivalent to "rm -rf /" with "rm -rf ~/blue /"

Re:Count to ten when a plane goes down by jonreem on Monday July 21, 2014 @08:13PM (#8066791)
On any modern system it's actually "sudo rm -rf / --no-preserve-root" and then entering your password while staring at the command.

"rm -rf ~/blue /" will not come close to deleting / unless you are in the habit of running every command as sudo, even ignoring the presence of --no-preserve-root

Re:Count to ten when a plane goes down by jfb on Monday July 21, 2014 @10:32PM (#8067143)
Much, much, much the worse is "rm -rf ~ /blue". I don't give a crap about 99% of the stuff outside of $HOME, but of course, the stuff in $HOME is the stuff that's trivial to destroy.
Re:Count to ten when a plane goes down by lloeki on Tuesday July 22, 2014 @05:00AM (#8067933)
You're missing the point:

    $ cd dir where there are source files and temp files
    $ rm *.tmp # or so you think
    '.tmp not found'
    # too bad
Re:Count to ten when a plane goes down by daurnimator on Monday July 21, 2014 @08:21PM (#8066820)
Except when: (these are terrible lessons to learn)

1. You type it into the wrong system (D'oh)

2. You have run `mount --bind / /somewhere/else` then `rm -rf /somewhere` a week later

:(

Re:Count to ten when a plane goes down by colanderman on Tuesday July 22, 2014 @11:04AM (#8069337)
It boggles my mind that --one-file-system is not the default :/
Re:Count to ten when a plane goes down by daurnimator on Tuesday July 22, 2014 @01:44AM (#8067533)
> Not really, a lot of novice unix users are of the habit of removing files with -rf switch. I cringe everytime I see it.

Every few days I remind myself of this.... then I have to delete another directory with a git repository in it, and end up add the -f in again

Re:Count to ten when a plane goes down by couchand on Tuesday July 22, 2014 @08:55AM (#8068651)
I run into this all the time, too. Now my -rf usage is almost always wrapped by this:

    rmgit()
    {
        git status
        read -p "Are you sure? " -n 1 -r
        echo
        if [[ $REPLY =~ ^[Yy]$ ]]
        then
            rm .git -rf
        fi
    }
Re:Count to ten when a plane goes down by anon4 on Tuesday July 22, 2014 @09:07AM (#8068725)
I think this would be a bit better for interactive cases. Note: written just now, I haven't actually felt the need for this safeguard... yet.

    rmrf()
    {
        (echo "The following files are going to be deleted!!!"
         for FILE in "$@"; do
             echo "<<<" "$FILE" ">>>"
         done) | less
        read -p "Are you sure? " -n 1 -r
        echo
        if [[ $REPLY =~ ^[Yy]$ ]]
        then
            rm -rf "$@"
        fi
    }
Re:Count to ten when a plane goes down by colanderman on Tuesday July 22, 2014 @11:02AM (#8069329)
Doesn't help against network filesystems mounted in subdirectories. --one-file-system (which really ought to be the default) prevents this.
Re:Count to ten when a plane goes down by mandalar12 on Tuesday July 22, 2014 @02:49AM (#8067650)
What would be the "good" alternative ? I often tries "rmdir" or "rm -r" if the directory is not empty and very often there are some "protected files" so I add -f. Thus it happens that I directly lauch "rm -rf".
Re:Count to ten when a plane goes down by couchand on Tuesday July 22, 2014 @08:48AM (#8068625)
Watch it fail first, verify that the failure makes sense, check to see if there's a way to delete one file with -f before deleting the rest with -r. Use -rf only as a last resort, and only by appending the f to an already-failed command whose syntax you've validated.
Re:Count to ten when a plane goes down by artursapek on Monday July 21, 2014 @09:45PM (#8067068)
More easily, "rm -rf ~" with a premature "Enter"
Re:Count to ten when a plane goes down by corobo on Tuesday July 22, 2014 @05:03AM (#8067943)
do the -rf after the directory to avoid this in future

Premature enter just results in:

[web@server /]$ rm ~

rm: cannot remove `/home/web': Is a directory

Re:Count to ten when a plane goes down by krylon on Tuesday July 22, 2014 @01:02PM (#8070072)
Hehe, I did something like that once, except that I typed "rm -rf ~ /blue/". There was no /blue/, but I managed to wipe out my home directory, and I did not have a backup. :-| It was on my personal machine, so at least I did not delete anybody else's files, but I still got burned hard enough to learn a valuable lesson.
Re:Count to ten when a plane goes down by svachalek on Monday July 21, 2014 @08:13PM (#8066793)
The / key was right next to Enter on a lot of old keyboards. It was quite easy to type 'rm -rf /tmp/garbage*' and have a simple fumble turn it into 'rm -rf /'. I mean, there's this guy I know, he did that once.
Re:Count to ten when a plane goes down by australis on Monday July 21, 2014 @08:26PM (#8066837)
There's also the chance of it happening when writing a script

Such as this classic:

https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commi...

Re:Count to ten when a plane goes down by jzwinck on Monday July 21, 2014 @08:39PM (#8066878)
Ten years prior to that, Apple had a similar bug in one of its installer scripts on OS X. I have a hard time finding much about it online now, because it happened at a time when OS X and the Internet were a lot less popular than today, but what I recall is that an unexpectedly customized installation directory (say with spaces or one level closer to "/" than the default) would cause the installer to delete a whole lot of things.
Re:Count to ten when a plane goes down by iopq on Wednesday July 23, 2014 @01:24AM (#8073023)
I once installed GGClient in C:/Program Files/ instead of any particular folder

so of course, I said "I'll just uninstall it from there and install it in the correct folder" and it proceeded to delete C:/Program Files/

Re:Count to ten when a plane goes down by bentcorner on Tuesday July 22, 2014 @12:29AM (#8067391)
There's also this one from Pool of Radiance's 2001 release:

http://www.rpgfan.com/news/2001/1416.html

Uninstall wipes out your Windows directory.

Re:Count to ten when a plane goes down by Paradigma11 on Tuesday July 22, 2014 @09:59AM (#8068988)
I still have nightmares from this buggy mess. To add insult to injury the shop didn't want to take the game back afterwards.
Re:Count to ten when a plane goes down by thinkpad20 on Monday July 21, 2014 @09:15PM (#8066993)
The one that I did only a few months ago was something like

    $ cp -r path/to/some/directory path/to/very/important/directory
    $ (run some commands to verify copy did what I wanted)
    $ rm -r path/to/some/directory path/to/very/important/directory
Of course, all I had meant to do was delete `path/to/some/directory`, but I just pressed 'up' in my history and switched `cp` to `rm`. Of course I hit Ctrl-C in an instant, but my FS was already hosed...
Re:Count to ten when a plane goes down by thefreeman on Monday July 21, 2014 @08:37PM (#8066872)
Not really, on my keyboard at least / is directly next to . and you could feasibly be clearing out a directory or something with rm -rf .
Re:Count to ten when a plane goes down by jessaustin on Monday July 21, 2014 @08:46PM (#8066897)
It's my habit to never use the -f flag until I get those annoying confirmation messages. I <CTL>-c to cancel that command, then scroll up and add the flag to run again. I think this is a good habit? Anyway, the worst thing I've done along these lines was resetting a dev DB that had seen considerable un-backed-up configuration work. I couldn't blame rm for that.
Re:Count to ten when a plane goes down by colanderman on Tuesday July 22, 2014 @11:00AM (#8069315)
Eh, "rm -rf $TEMPDIR/$TEMPFILE" in a shell script is just a couple typos away from deleting everything on the network. Yet I've seen people put crap like that in build scripts even after they've previously inadvertently deleted half the network drives.

Fortunately, despite rm's poor choice of options and bash's poor default handling of variable name typos and the obvious PEBKAC, backups saved the day here.

People are human. Policy ought to reflect this.

Re:Count to ten when a plane goes down by sentenza on Tuesday July 22, 2014 @06:44AM (#8068237)
Be honest, who doesn't have

rm -rf *

in their shell history? Now it's just one accidental twitch away.

Re:Count to ten when a plane goes down by TimWolla on Tuesday July 22, 2014 @07:29AM (#8068354)
I suspect everyone tried to remove all dotfiles and dotfolders with rm -r .* as well...
Re:Count to ten when a plane goes down by canjobear on Monday July 21, 2014 @07:49PM (#8066709)
Are you trying to say it's OK because Unix behaves analogously?

It is definitely a problem with Unix also.

Re:Count to ten when a plane goes down by bonaldi on Monday July 21, 2014 @07:59PM (#8066750)
It is. Which is why everyone in Unix who types "rm -rf " then types their next character _very carefully_ and reads the line before committing.

I'm trying to say that when you've got something dangerous without safeguards, you take care around it. Not taking care of known-dangerous things and causing severe damages as a result is an arguably good case for dismissal.

Re:Count to ten when a plane goes down by graylights on Monday July 21, 2014 @08:07PM (#8066773)
The proper answer is to type "rm <dir> -rf" otherwise you're risking a stray strike on enter.
Re:Count to ten when a plane goes down by gatehouse on Monday July 21, 2014 @10:44PM (#8067181)
The other proper answer is to have a good backup and recovery system.
Re:Count to ten when a plane goes down by goblin89 on Tuesday July 22, 2014 @06:03AM (#8068133)
> The other proper answer is to have a good backup and recovery system.

And, of course, that should've been the solution to OP's incident with the Korean Airlines flight 007. Backups, surprisingly, are scarcely mentioned at all in this whole thread.

Re:Count to ten when a plane goes down by mreiland on Tuesday July 22, 2014 @02:40AM (#8067634)
rm -rf / is not quite the same as the f7 key restarting all machines sitting right next to the f6 key to restart a single machine.

you cannot fat finger rm -rf /

Re:Count to ten when a plane goes down by claudius on Tuesday July 22, 2014 @02:51AM (#8067654)

  # rm -rf /tmp/bla

  # rm -rf / tmp/bla
Re:Count to ten when a plane goes down by mreiland on Wednesday July 23, 2014 @12:37PM (#8075286)
no
Re:Count to ten when a plane goes down by astrodust on Tuesday July 22, 2014 @03:20AM (#8067704)
You can fat-finger enter before you're done typing.
Re:Count to ten when a plane goes down by mreiland on Wednesday July 23, 2014 @12:38PM (#8075291)
that's a pretty fat fucking finger...
Re:Count to ten when a plane goes down by thrownaway2424 on Monday July 21, 2014 @11:48PM (#8067304)
You forgot the part where the only reason he was fucking with the F6 key in the first place was to play a game. That's irresponsible and grounds for firing.
Re:Count to ten when a plane goes down by ghayes on Tuesday July 22, 2014 @12:20AM (#8067371)
Actually, from the article he was a system administrator and another employee had been playing a game which froze her own terminal. The author did nothing wrong except press the wrong button (and to your point: not report his coworker for playing games on her terminal in her free-time).
Re:Count to ten when a plane goes down by bdunbar on Tuesday July 22, 2014 @11:21AM (#8069438)
> not report his coworker for playing games on her terminal in her free-time).

I was enlisted in the Marines, MOS as a programmer (4063), 1989 - 1993. I never really programmed, but spend my time as a small computer support guy.

Computer games were officially forbidden, but unofficially tolerated, provided one was discrete. I suspect the same 'don't ask don't tell' policy applied to EUCE at the embassy in question.

Sea story. My team was once directed by our boss, the Major, to 'sweep' the command for 'games' and remove them from computers. This took the better part of two weeks, and was massively unpopular with our peers. 'A Marine On Duty Has No Friends', we repeated to ourselves. We even got into the spirit of things and deleted games from _our_ computers.

Near the end of this evolution I hand-carried some paper into my Major's office. He was, yes, playing a computer game.

He did at least have the grace to look embarrassed.