How A Steam Bug Once Deleted All Of Someone’s User Data

In a retrospective, [Kevin Fang] takes us back to 2015, when on the Steam for Linux issue tracker [keyvin] opened an issue to report that starting the Steam client after moving the Steam folder had just wiped all of his user data, including his backup drive mounted under /media. According to [keyvin], he moved the standard ~/.local/share/steam to a drive mounted under /media and symlinked ~/.local/share/steam to this new location on the external drive. He then tried starting Steam, which failed, before Steam crashed and tried reinstalling itself. That’s when [keyvin] realized that Steam had apparently recursively deleted everything owned by his user from the root folder.

<img decoding="async" data-attachment-id="657405" data-permalink="https://hackaday.com/2024/01/20/how-a-steam-bug-once-deleted-all-of-someones-user-data/steam_linux_shell_rm_rf/" data-orig-file="https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg" data-orig-size="1119,812" data-comments-opened="1" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="steam_linux_shell_rm_rf" data-image-description data-image-caption="

The infamous Valve code that made Linux users sad.

” data-medium-file=”https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg?w=400″ data-large-file=”https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg?w=800″ class=”size-medium wp-image-657405″ src=”https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg?w=400″ alt=”The infamous Valve code that made Linux users sad.” width=”400″ height=”290″ srcset=”https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg 1119w, https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg?resize=250,181 250w, https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg?resize=400,290 400w, https://hackaday.com/wp-content/uploads/2024/01/steam_linux_shell_rm_rf.jpg?resize=800,581 800w” sizes=”(max-width: 400px) 100vw, 400px”>

The infamous Valve code that made Linux users sad.

In the issue thread, user [doofy] got hit by the same bug when trying to directly start the ~/.local/share/steam/steam.sh script with debugging enabled. He then was the first to point out the rm -rf in that steam.sh script, but since this particular line is in a function only called when Steam tries to remove and reinstall itself to ‘fix’ a botched start, how did this happen? Ultimately it seems to be because of the STEAMROOT variable being set to an empty string, and another unset variable triggering the reset_steam() function, leading to the demise of all the user data.

Since then Valve has presumably fixed the issue, as no further users have filed tickets, but it’s concerning that a similar issue seems to still exist on Windows. Whether or not the original Linux issue has been fixed, it shows clearly how one should always check return values and perhaps, just maybe, never do an automated rm -rf or equivalent.

This post was originally published on this site