Don't want to see articles from a certain category? When logged in, go to your User Settings and adjust your feed in the Content Preferences section where you can block tags!
We do often include affiliate links to earn us some pennies. See more here.

Steam Has A Rather Silly Bug, And It Can Remove Your Files

By - | Views: 14,222
tagline-image
Steam has had a bit of embarrassment on Linux recently, as an oversight in one of their scripts will cause it to remove all your files, eeek!

The issue is being a bit overblown though, as you need to do some pretty specific stuff to make it happen, and it isn't just on Linux, the issue does exist in some form on Windows too. On Windows for example if you install Steam inside a folder with other data, it will remove that too:
QuoteThe uninstallation process deletes the folder Steam was installed to to ensure it is fully uninstalled. If you accidentally installed Steam to a folder containing other data, for example C:\Program Files\ instead of C:\Program Files\Steam\, STOP! Do not run the uninstaller and instead carefully follow the instructions below for Manually Removing Steam, except only delete Steam-related files in step 3.

Source

On Linux the issue has been tracked to being inside their "steam.sh" file, as it does no checking on the steam root folder.

Here is the part in question:
Quote# Scary!
rm -rf "$STEAMROOT/"*

It's amusing (in a bad way) that it even has a comment of "Scary!", so they probably knew they should have done some extra checks anyway. It's pretty basic in most languages to check something exists properly before trying to remove it.

It seems the issue arises if you move your Steam directory somehow, so if you aren't messing with moving it around and doing some linking, then you should be okay. Still, pretty scary stuff.

It should be sorted soon though, as "johnv-valve" is on the job and has plans for a fix already.

You can see the rather long bug report here. Sadly, the community seems to be quite silly and have started posting a lot of useless crap on the report, but it looks like Valve may have cleared the useless comments up.
Remember folks to keep bug reports clean as reports and feeback, don't go posting stupid memes. Article taken from GamingOnLinux.com.
Tags: Editorial, Steam
0 Likes
About the author -
author picture
I am the owner of GamingOnLinux. After discovering Linux back in the days of Mandrake in 2003, I constantly came back to check on the progress of Linux until Ubuntu appeared on the scene and it helped me to really love it. You can reach me easily by emailing GamingOnLinux directly. Find me on Mastodon.
See more from me
The comments on this article are closed.
20 comments
Page: 1/2»
  Go to:

Von Jan 17, 2015
It is already fixed in beta client.
if [ "$STEAMROOT" != "" ]; then
        rm -rf "$STEAMROOT/"*
fi


These guys seem to be rather bad at bash. =/
FlutterRage Jan 17, 2015
I think there are more validation checks necessary instead of just checking if the variable is empty. At least check if it's actually a directory. If I used such a bad error handling on my clients' systems I'd be in huge trouble.
sonic Jan 17, 2015
And thats why I have another user account for running proprietary apps...
Von Jan 17, 2015
Quoting: sonicAnd thats why I have another user account for running proprietary apps...
It's impossible to close source in a shell script. So a complaint about proprietary software is completely invalid here.
Von Jan 17, 2015
Quoting: FlutterRageI think there are more validation checks necessary instead of just checking if the variable is empty. At least check if it's actually a directory. If I used such a bad error handling on my clients' systems I'd be in huge trouble.
Yes, [[ -d "$STEAMROOT" ]] would have been a much better solution.
Teodosio Jan 17, 2015
Quoting: sonicAnd thats why I have another user account for running proprietary apps...
That is a smart idea.
lucifertdark Jan 17, 2015
Perhaps it's an incentive to stop people uninstalling Steam? j/k
gojul Jan 17, 2015
Workaround :
set in your /etc/bash.bashrc :

alias rm='rm --preserve-root'

Anyway this is dangerous...
DrMcCoy Jan 17, 2015
No, --preserve-root doesn't help here (and it's enabled by default in many distributions already).

They're doing
rm -rf $STEAMROOT/*

Note the *. Which, when $STEAMROOT is empty, expands to

rm -rf /bin /boot /dev [...]

--preserve-root is completely okay with deleting that.
thelimeydragon Jan 17, 2015
I create a special file called "-i" in directories I want to keep safe.

I do this by doing:

touch ./-i

forces rm to be interactive.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.