News for hackers. Stuff that matters.
Re:Unix Administration Horror Stories (1993) by deathanatos on Wednesday September 02, 2015 @11:48PM (#10163252)
In the rm section of horror one story hints towards, and another explicitly notes,

> .* expands to ../*

Not on my box it doesn't. Was this true in some (rather cruel) past?

Re:Unix Administration Horror Stories (1993) by wazoox on Thursday September 03, 2015 @01:34AM (#10163482)
Actually it simply expands to .., so rm -rf .* happily deletes ../, therefore ./, etc. If you're in /tmp at the time you're making this mistake, it will clobber /. Current GNU rm may be more careful, though, and warn you of unintended consequences.
Re:Unix Administration Horror Stories (1993) by deathanatos on Thursday September 03, 2015 @02:44AM (#10163622)
Actually, that was my point: for me, .* does not expand to .. or .; the special entires "." and ".." appear to not be considered during globbing.

After closer inspection, it turns out that this is because I'm a zsh user:

  % zsh -c 'echo .*'
  zsh:1: no matches found: .*
  % bash -c 'echo .*'
  . ..
Indeed, zsh's manual states:

> No filename generation pattern matches the files `.' or `..'.

… and I've just added another entry to my list of reasons as to why I love zsh.

Re:Unix Administration Horror Stories (1993) by nailer on Thursday September 03, 2015 @09:42AM (#10164860)
Same safe behaviour happens when using bash and BSD rm (OS X):

    $ mkdir foo
    $ cd foo
    $ touch 1
    $ touch 2
    $ touch 3
    $ rm *
    $ ls -la .
    total 0
    drwxr-xr-x   2 mike  wheel   68  3 Sep 14:41 .
    drwxrwxrwt  18 root  wheel  612  3 Sep 14:41 ..
Re:Unix Administration Horror Stories (1993) by protomyth on Sunday September 06, 2015 @02:30PM (#10178494)
I though the spec on rm says it cannot delete the directory you are currently in? http://pubs.opengroup.org/onlinepubs/009604499/utilities/rm....

Plus, it mentions . and .. as no-nos

Re:Unix Administration Horror Stories (1993) by 6t6t6 on Thursday September 03, 2015 @02:32AM (#10163600)
I think it is not a rm thing but a bash (or sh) thing. The rm command receives the parameter after the wildcards have been expanded.

Unix in the past was for the tough men...

Re:Unix Administration Horror Stories (1993) by lstamour on Thursday September 03, 2015 @01:20AM (#10163451)
I'm not sure but my persona horror story on OS X was when I typed mkdir ~ then tried to delete my new folder. Needless to say, I'm now paranoid about backups ;-)
Re:Unix Administration Horror Stories (1993) by skuhn on Thursday September 03, 2015 @04:05AM (#10163798)
Things did used to work this way. As a result of some early trauma I have always written it as 'rm -rf .??*' to avoid matching '.' or '..'.