Live data from Hacker News

Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

github.com

61–70 of 280 posts

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#63
post #50

Earlier quoted context omitted.

"rm -df /" does nothing. "rm -df" does not remove non-empty directories.

That's awesome, I didn't catch the s/r/d/.

That's because I ninja'd the -d in after ;) also just ninja'd in a -- to prevent stray options.

Note also that putting a "*" in the MANIFEST doesn't do anything either, as neither xargs nor rm expands wildcards (only bash does).

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#64

Earlier quoted context omitted.

Yep, my thought exactly. My standard bash header is #!/bin/bash set -eu IFS=$'\n\t' (Wish there was a shorthand version of pipefail, then I'd always use that too.)

You can save a line by doing #!/bin/bash -eu

Which is no equivalent if the script is executed using "bash script.sh" ;).

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#65

Earlier quoted context omitted.

There are, it's called users, and groups, and file permissions. Applications like steam should really be running under a separate user so they can't write to personal files (and maybe just have read permissions). But of course proper application isolation and file permissions is something few people do correctly on their personal machines, let alone know about. Window managers don't make it any easier, and I put a lo…

It seems like the direction Linux is going (albeit slowly) is to use selinux instead of different users for this type of isolation.

Yes, however linux supports this sort of security right now and has for many many years, and properly used would have prevented these mishaps. More than backing up their data, I blame the users for being incompetent users of computers in general.

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#66
post #3

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…

Offending commit @ https://github.com/lrusak/steam_latest/commit/21cc14158c171f...

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#67

Many of the comments mentioned this should have been caught in the code review. I suspect they don't perform code reviews. Makes me wonder, is there a tool, system, service for auditing how many 'pair of eyes' have reviewed a given line of code. This would be hard to determine, but could be useful. I am envisioning a heatmap bar or overlay that indicates the number of reviews a line of code has received.

I would use that. For unpopular open source projects. Let me review and comment other people code, make them review mine. Some rating is probably needed. Very nice idea.

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#68

# Scary! rm -rf "$STEAMROOT/"* Anybody who writes a line like this deserves their software engineer license revoked. This isn't the first time I've seen shit like this (I've seen it in scripts expected to be run as root, no less); it makes my blood boil. Seriously. "xargs rm -df -- EDIT: I shouldn't be so harsh, if it weren't for the comment admitting knowing how poor an idea this line is.

Is there proof that the comment was committed with the line of code?

Of course once it was a identified a concerted effort could have been made to rectify the situation.

Sometimes a problem is identified working on some unrelated aspect of the software and the developer does not have time or scope to change the offending piece of code but wants to place a red flag.

Of course this example does not appear to be systematic approach to marking "fixme", unless of course their fixme tag is actually #scary.

Edit: Of course one would hope they have raised a rather high priority work item for this.

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#69
post #31

For those of you worried about important files, chattr +i is a useful defence. No easy way of applying this automatically. Long ago I had a kernel hack that would kill any process that attempted to delete a canary file. Worked OK but no chance of it ever going mainstream.

Nice. Although if I forgot I did this, I suspect that I will have a difficult time figuring out why I cannot delete the file.

Re: Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user

#70

If you're curious about who the "Scary!" guy is, someone pointed to where the code was checked in: https://github.com/lrusak/steam_latest/commit/21cc14158c171f...

That looks like an unofficial repo. I don't think the guy who committed that actually wrote it.
Post reply on HN