Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not my code, but I was involved in cleaning up the aftermath. Financial company, a programmer had made a one line change to clean up some working directory at the end of a program. Something like

  "rm -rf /var/scratchdir /"
Yeah the space was a typo. Wasn't running as root but was able to make a pretty big mess regardless.


I move things to /tmp now instead of deleting them. Where the margin of error is a single character "rm" is just too risky.


I did something like that in some code in a from-scratch embedded Linux distro, maybe nine years ago:

  rm -rf $MISPELED_ROOT_DIR/lib/
Oops, the script didn't have "set -u", and I happened to run that as root. So, /lib directory gone.

I managed to recover that machine by copying libs from another one running the same distro.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: