News for hackers. Stuff that matters.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by DSMan195276 on Tuesday March 24, 2015 @01:23AM (#9255028)
That's not completely true. At least with the GNU tools, 'rm' won't delete the root directory unless you specifically give it the '--no-preserve-root' flag. Since that flag has no use outside of deleting root, it's unlikely it has the flag on it. With that in mind the script must do some type of manual deleting for some reason.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by viraptor on Tuesday March 24, 2015 @01:29AM (#9255038)
I believe that "--preserve-root" applies only to / itself. That means `rm -rf /*` will expand to `rm -rf /bin /dev /etc /lib ...` and delete all anyway.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by DSMan195276 on Tuesday March 24, 2015 @01:46AM (#9255069)
That's accurate. `rm -rf /* ` will still work to delete everything. But that said, `rm -rf "$STREAMROOT/"` can't ever expand to that, and more-over since the expansions in double-quotes it won't be subject to path expansion by bash. So even "/* /", which would normally expand into "/bin/ /dev/ /etc/ ..." won't. You can see what I mean yourself, just use echo:

    `echo /* `: /bin /dev /etc /lib ...

    `echo /*/`: /bin/ /dev/ /etc/ /lib/ ...

    `echo "/*"`: /*

    `echo "/*/"`: /*/
If you try it with `ls`, you'll find that `ls "/* "` results in `ls: "/* ": no such file or directory`.

Edit: Formatting.

Re:Bug 1202858 – Restarting squid results in deleting all fi... by pskocik on Tuesday March 24, 2015 @02:40AM (#9255167)
The original example was `rm -rf "$STREAMROOT/"*`, though (the asterisk being out of the double quotes.) Now that glob will expand.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by DSMan195276 on Tuesday March 24, 2015 @02:58AM (#9255213)
Ah, my apologies, I think that was HackerNew's markup at work. The '* ' wasn't there when I looked before.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by mirkules on Tuesday March 24, 2015 @02:31AM (#9255148)
This just happened to my coworker today. I'm sitting behind him telling him which commands to type (he's new to Linux...) when suddenly he jumps the gun and pushes enter just as I say "slash". My heart nearly stopped. I didn't even know preserve-root existed (plus I always iterate not to log in as root). It was a snapshotted vm but we still would have lost the day's work.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by arthurcolle on Tuesday March 24, 2015 @04:43PM (#9259347)
Coworker - intern? :P
Re:Bug 1202858 – Restarting squid results in deleting all fi... by jhallenworld on Tuesday March 24, 2015 @01:35AM (#9255050)
It should optimize for this case and run mke2fs instead.
Re:Bug 1202858 – Restarting squid results in deleting all fi... by kevan on Tuesday March 24, 2015 @02:00AM (#9255094)
In the original Steam bug the asterisk is outside the double-quotes and path expansion definitely applies.