A major bug has been found in the Steam script

Jan 16, 2015 13:25 GMT  ·  By

Users have found out that Steam for Linux is capable of deleting the entire home directory under certain circumstances, which would present a major problem for users.

It's already a known fact that Steam for Linux is capable of losing the installed games if the right conditions are met, and this is not even something specific to the Linux platform. Now, a user has found out, the hard way, that the Steam for Linux client is also able to delete the Home directory or at least all the user-owned files in that folder.

As you can imagine, this is a pretty important problem and it's very likely that developers will correct it as soon as possible, but it's the kind of stuff that should not really happen at all.

Steam for Linux can be hazardous for your PC's health

A user reported on GitHub that, after he moved the Steam installation from its initial place, he found out that all the files and folders owned by his username were gone. After some of the other users performed a small surgery on the steam.sh script, they found something that's really worrying.

"I moved the folder in the title to a drive mounted under /media/user/BLAH and symlinked /home/user/.local/steam to the new location. I launched steam. It did not launch, it offered to let me browse, and still could not find it when I pointed to the new location."

"Steam crashed. I restarted it. It re-installed itself and everything looked great. Until I looked and saw that steam had apparently deleted everything owned by my user recursively from the root directory," reads the entry on GitHub.

Another user pointed out the problem in the Steam 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)"
STEAMDATA="$STEAMROOT"
The problem is that the return is empty, the rm -rf "$STEAMROOT/"* is the equivalent of "rm -rf "/"*

The problem hasn't been sorted out and there is no sign of the Valve devs investigating this just yet, although that will probably happen very soon.