429 points · by geoffbp · 11y ago · 168 comments
Actual results:
All files are deleted on the machine.
Expected results:
Squid is restarted.
Not many details yet but it sounds similar to the Steam bug [0] from last year.[0] https://github.com/valvesoftware/steam-for-linux/issues/3671
Stopping squid: ................[ OK ]
rm: cannot remove `/boot': Device or resource busy At the time of this writing, RHEL 6.7 is still pre-beta
and this bug was found in an *UNRELEASED* update to squid.
Bad enough, but not like it's out in production. rm -rf "$STEAMROOT/"* set -eu
on top of your bash scripts -- execution will stop on errors (non-zero retvals) and on undefined variables.[1] https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/issue...
There were some circumstances where if there was no cache_dir line configured, or if the cache_dir was a link or something, the details are very sketchy in my mind after so much time, but it would end up destroying /.
I'm guessing this is of that same nature.
It looks like a bug in the init script; runnign it as squid's user wouldn't have triggered destroying the whole filesystem; likely just squid's config and anything under its /var.
Which is what happens when you have every daemon writing their own PID handling code, running as root, in a language whose interpolation rules nobody really understands.
It looks like a bug in the init script...
Ha ha ha ha ha ha ha.
touch /-@
I also always do it in my home directory: touch ~/-@
That's the first thing I do on a new host.When accidentally running rm -f *, the command expands to -@ first, which is not a valid option and makes the command fail before doing any harm
rm: illegal option -- @
usage: rm [-f | -i] [-dPRrvW] file ...That way the pain of having to type AsteRISKdeleteALL instead of * for rm events offsets any anxiety by far.
You can also catch the rm and mv to a difectory with quota's you can call a recycle bin, some low end attached storage can be fine as well as not many situations when your wildcard deleting with a time factor. Can accommodate this in your own skulker to clean up in a more organised way overall in a timely manner. and and scripts you can path to the real rm command if needs be, last time I called it P45Generator, but not the finest for readability in any such scripts.
if a directory has 1.txt, 2.txt, and 3.txt then << rm * >> expands to "rm 1.txt 2.txt 3.txt" and is then executed.
if you have -@, 1.txt, 2.txt, and 3.txt, that expands to << rm -@ 1.txt 2.txt 3.txt >>, and that can't execute.
(if you really wanted to remove your -@ you'd do << rm -- * >> because a double-dash signals the end of command-line options.)
That sounds like a bug to me, or at least depending on suboptimal behavior.
Example:
$ echo /*
/bin /boot /dev /etc /home (...)
My 'zsh' has this one too, when I 'rm -rf /some/dir/' always asks if I'm "sure". Truth to be told, I'm not even expecting the text in "stdout" anymore, my finger goes to the 'y' automatically, which means that if I make something stupid it won't be able to protect me :-P
The last couple of years I stopped doing 'stupid things' by stop working on the shell when I'm very tired. That was the cause of my rm-related-incidents in the past :-)
touch /--
rm -rf *
(admittedly, this would be a malicious attempt rather than a careless bug)Ooops.
If you uninstalled our software it deleted a major chunk of your Windows registry, crippling your computer. It was a one character error in our script. The first ticket read "Uninstalling [Product] destroys your computer".
I was responsible for customer support. Good times! Was a rough week. We managed to not get sued.
This is a bug from 15 years ago, much much before the sandbox feature was introduced.
A sandboxed iTunes would have prevented that.
But I'm neither a redhat user nor an OS dev, so I might completely wrong.
In stop():
rm -rf $SQUID_PIDFILE_DIR/*
and in restart(): rm -rf $SQUID_PIDFILE_DIR/*
SQUID_PIDFILE_DIR is hardcoded to "/var/run/squid" at the top of my copy of the init script. But, neither of those rm commands check first to make sure that SQUID_PIDFILE_DIR isn't empty (or, better yet, is in /var and doesn't contain ".."), and either the submitter's copy of the script is mangled or something else somewhere is stomping on SQUID_PIDFILE_DIR in the shell environment....I should grep my init scripts for "rm".
https://github.com/mozilla-services/squid-rpm/blob/master/SO... ... however ... whatever that is, does.
Did they take this upstream init script somehow?
https://bugzilla.redhat.com/show_bug.cgi?id=1102343
I guess they applied that change which was obviously written against a very different init script where the variable is actually defined, got QA to test it and immediately backed it out.
"Thanks Swapna and Red Hat QE for catching this issue before the package was released. Great work!"
Looks like this wasn't released into production.For more details on why this issue doesn't affect squid users: https://rwmj.wordpress.com/2015/03/24/restarting-squid-resul...
It very well could have been an instance of the bumblebee bug (https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/issue...) where it's "rm -f / some/file" instead of "rm -f /some/file"
Link to the code if you want to make that claim.
Listen to yourself. We've all written dumb bugs. We've all had that one line of code that was an obvious mistake. I still trust people who write a bug here and there because if I didn't I would have to forgo trusting everyone for everyone makes dumb mistakes sometimes.
Does it really matter if no one commented "Oops, we screwed up"? It's kinda self-evident that there was a mistake and there's not really much to say; it's clear from the description how bad it is and marking it "Fixed in version" already says it all pretty much.
To me it does. You just deleted someone's hard drive, an apology wouldn't be out of order.
The context matters a lot. This title is linkbait. It omits mentioning that this was not publicly released and the reporter is a QA for Red Hat. Given that context I doubt you'll still agree an apology is so necessary or that this was not handled well.
Or, even if you don't want to declare a threshold, publish the current stats on its front page: "Over the last 30 days, our 99-percentile triage wait time was: XX hours."
Similarly, open tickets with priority=urgent should never go 24 hours without a new comment from the owner.
Now there's a good idea. Major open source projects should have software quality dashboards tracking things like that.
We're now seeing hospital emergency rooms displaying their current wait time in minutes on billboards.
"Why is grepping /etc taking so long? Binary files in /etc?!? WTF?!?"
Coming from Debian, Redhat seems to make a lot of irk-worthy choices.
-d, --directories=ACTION how to handle directories;
ACTION is 'read', 'recurse', or 'skip'
-D, --devices=ACTION how to handle devices, FIFOs and sockets;
ACTION is 'read' or 'skip'
-r, --recursive like --directories=recurse
-R, --dereference-recursive likewise, but follow all symlinksYou'll find most distros follow some FHS standard, although there's some differences in interpretation.
(That said, making the package self contained is the most sensible way for the developer to release it. It's just not a good option for a distro package.)