TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Simple Bash syntax error in Steam for Linux executed “rm -rf /*” (2015)

31 pointsby jakejarvisabout 6 years ago

3 comments

smhendersonabout 6 years ago
My first thought on reading the headline was &quot;what Linux still did that in 2015&quot;? I thought I read somewhere years ago that Sun, BSD and GNU rm all had checks in them to spot the &#x2F; or &#x2F;* and refuse to run. According to this SE page[1] GNU even has an option to tell rm &quot;no I really do want to blow away my whole root&quot; by using &quot;--no-preserve-root&quot;.<p>Apparently the &quot;fix&quot; only applies to the root user. The article is about a regular user who recursively lost everything he owned starting at &#x2F;.<p>Ouch!<p>[1] <a href="https:&#x2F;&#x2F;unix.stackexchange.com&#x2F;questions&#x2F;19547&#x2F;how-far-can-you-go-with-rm-rf-as-root" rel="nofollow">https:&#x2F;&#x2F;unix.stackexchange.com&#x2F;questions&#x2F;19547&#x2F;how-far-can-y...</a>
评论 #19627080 未加载
jimrandomhabout 6 years ago
The real problem here is that a multi-hundred-line script was written in bash. While bugs can happen in any language, this particular error was due to a bash-specific pitfall, and bash has <i>many</i> such pitfalls. Bash is really only suitable for interactive use, or for bootstrapping the install of another scripting language.
评论 #19628477 未加载
MrMemberabout 6 years ago
&gt;Line 468: rm -rf &quot;$STEAMROOT&#x2F;&quot;*<p>Oh man, reading that line made me cringe.
评论 #19627047 未加载