6 ms·
Part of the mystery of the infamous shell fork bomb is that it picks a weird name like ':' for the function name. :(){ :|:& };: Turns into a less mysterio
by rgrau 5y ago
Part of the mystery of the infamous shell fork bomb is that it picks a weird name like ':' for the function name.
:(){ :|:& };:
Turns into a less mysterious:
bomb() {
bomb | bomb &
}
bomb
I started a booklet with some of these tricks and explanations in https://raimonster.com/scripting-field-guide/ https://raimonster.com/scripting-field-guide/, in case anyone wants to give feedback (or PRs), it'd be much appreciated.
- ufo 5y agoI'll take this chance to ask a fork bomb question I always had: on Linux, is there a way to stop a fork bomb once it gets going, other than turning off the power?
- 411111111111111 5y agoAs far as I know the only way to handle a fork bomb is to limit the allowed forks an instance is allowed to create. This limit isn't set by default in most distributions, but does exist. It would still crash the bombed shell but the server itself would be safe and a manual kill signal could be send to the bombing thread.
- yesenadam 5y agoGood stuff, thank you! Hope this helps a little. (I could send more corrections if you like as I read more.) rethoric -> rhetoric 1 off -> one-off ment -> meant low hanging -> low-hanging flag you many of those ticking bombs -> flag many of those ticking bombs for you No matter which editor you are using, but you -> No matter which editor you are using, you The best example in that StackOverflow is this one: -> [maybe delete this line? or write something else. I don't know its purpose, it makes no sense.] a bunch of elements from one go -> a bunch of elements in one go functions in shell -> shell functions using user's input -> using user input/using the user's input you can unset -> You can unset lots of code you see around rely on -> lots of code you see around relies on to thinking on creating -> to thinking about creating
- rgrau 5y agothanks so much! I'll fix all those right away :+1: