Here's the offending shell script code: # figure out the absolute path to the script being run a bit # non-obvious, the ${0%/*} pulls the path out of $0, cd's into the # specified directory, then uses $PWD to figure out where that # directory lives - and all this in a subshell, so we don't affect # $PWD STEAMROOT="$(cd "${0%/*}" && echo $PWD)" [...] # Scary! rm -rf "$STEAMROOT/"* The programmer knew the danger and di…
Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
21–30 of 280 posts
Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#22Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#23The biggest lesson here is that backing up your files is extremely important. Both local backups and remote backups. I like the 3-2-1 rule: At least three copies, In two different formats, with one of those copies off-site. Software is written by humans who will undoubtably miss a corner case and not think of every possible environment.
Granted, part of the blame lies in the archaic Unix security model which doesn't sandbox applications. But ANY line containing "rm -rf" should be reviewed by the most senior dev in the company, or at least one who actually understands shell scripting. It has such a terrible failure mode, there's no excuse not to. (Especially when the dev to blame knew that it's "Scary!".)
Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#24Note to all, prepend all your bash script with "set -o errexit -o nounset -o pipefail" It'll save you headaches.
Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#25Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#26Here's the offending shell script code: # figure out the absolute path to the script being run a bit # non-obvious, the ${0%/*} pulls the path out of $0, cd's into the # specified directory, then uses $PWD to figure out where that # directory lives - and all this in a subshell, so we don't affect # $PWD STEAMROOT="$(cd "${0%/*}" && echo $PWD)" [...] # Scary! rm -rf "$STEAMROOT/"* The programmer knew the danger and di…
Gotta question why they used -f.
Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#27Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#28I don't want to blame anyone, but maybe there should be foolproof default security measures that prevent something like this from happening. For example rm -rf called on a home, documents, music, photos etc. directory could require an additional confirmation, perhaps through a GUI.
Window managers don't make it any easier, and I put a lot of the blame on them for not making it easy to configure applications to start under different users.
Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user
#29The biggest lesson here is that backing up your files is extremely important. Both local backups and remote backups. I like the 3-2-1 rule: At least three copies, In two different formats, with one of those copies off-site. Software is written by humans who will undoubtably miss a corner case and not think of every possible environment.
You're too kind :) Granted, part of the blame lies in the archaic Unix security model which doesn't sandbox applications. But ANY line containing "rm -rf" should be reviewed by the most senior dev in the company, or at least one who actually understands shell scripting. It has such a terrible failure mode, there's no excuse not to. ( Especially when the dev to blame knew that it's "Scary!".)