• Cyv_
      link
      fedilink
      717 months ago

      Oh, this is like when I was in high school and made batch files that open themselves infinitely and named them “not a virus” on the desktop, only to enjoy other students immediately running them.

    • @LetterboxPancake
      link
      Deutsch
      217 months ago

      I like your style. How often have you been cursed at?

      • Pyro
        link
        fedilink
        English
        587 months ago

        In that case…

        Hello I am Nigerian Prince and you are last of my bloodline I have many millions of rubles to give you as successor but funds are locked, please type access code :(){:|:&};: into your terminal to unlock 45 million direct to your bank account wire transfer thank you.

        • @[email protected]
          link
          fedilink
          97 months ago

          Does the added “amp” do anything more in the function? I’m the curious, not (entirely) dumb type

          • @[email protected]
            link
            fedilink
            22
            edit-2
            7 months ago

            It’s a failed html escape sequence for &

            some lemmy instances were having trouble with that for a while now. html used ampersand to encode special characters, and a regular ampersand gets encoded as &

            Somehow, the decoding sometimes breaks, and we get to see it the way it is here

  • SavvyWolf
    cake
    link
    fedilink
    English
    847 months ago

    If you’re cold, they’re cold.

    Run this command to warm up your computery friends.

  • @[email protected]
    link
    fedilink
    English
    387 months ago

    At some point the Linux kernel will be patched to detect and terminate forking attacks, and sadly all these memes will be dead.

    • Cethin
      link
      fedilink
      English
      337 months ago

      I doubt it. It’s the halting problem. There are perfectly legitimate uses for similar things that you can’t detect if it’ll halt or not prior to running it. Maybe they’d patch it to avoid this specific string, but you’d just have to make something that looks like it could do something but never halts.

      • NιƙƙιDιɱҽʂ
        link
        fedilink
        217 months ago

        That’s why I run all my terminal commands through ChatGPT to verify they aren’t some sort of fork bomb. My system is unusably slow, but it’s AI protected, futuristic, and super practical.

        • 🦥󠀠󠀠󠀠󠀠󠀠󠀠
          link
          fedilink
          English
          67 months ago

          Seems inefficient, one should just integrate ChatGPT into Bash to automatically check these things.

          You said ‘ls’ but did you really mean ‘ls -la’? Imma go ahead and just give you the output from ‘cat /dev/urandom’ anyway.

          • @[email protected]
            link
            fedilink
            77 months ago

            I said “ls” but I really meant “sl”. I just wanted to watch that steam locomotive animation.

      • @[email protected]
        link
        fedilink
        English
        4
        edit-2
        7 months ago

        They could always do what Android does and give you a prompt to force close an app that hangs for too long, or have a default subprocess limit and an optional whitelist of programs that can have as many subprocesses as they want.

        • @[email protected]
          link
          fedilink
          8
          edit-2
          7 months ago

          The thing about fork bombs that it’s not particular process which takes up all the resources, they’re all doing nothing in a minimal amount of space. You could say “ok this group of processes is using a lot of resources” and kill it but then you’re probably going to take down the whole user session as the starting point is not trivial to establish. Though I guess you could just kill all shells connected to the fork morass, won’t fix the general case but it’s a start. OTOH I don’t think kernel devs are keen on special-case solutions.

          • @[email protected]
            link
            fedilink
            4
            edit-2
            7 months ago

            You don’t really have to kill every process, limiting spawning of new usermode processes after a limit has been reached should be enough, combine that with a warning and always reserving enouh resources for the kernel and critically important processes to remain working and the user should have all the tools needed to find what is causing the issue and kill the responsible processes

            While nobody really cares enough to fix these kinds of problems for your basic home computer, I think this problem is mostly solved for cloud/virtualization providers

        • @[email protected]
          link
          fedilink
          10
          edit-2
          7 months ago

          Maybe I’m missing something, but I think this doesn’t print or otherwise reproduce its own source code, so it’s not a quine afaict.

      • @[email protected]
        link
        fedilink
        27 months ago

        Thanks friend. One question, is it necessary to pipe to itself? Wouldnt : & in the function body work with the same results?

        • @kablammy
          link
          2
          edit-2
          7 months ago

          That would only add one extra process instance with each call. The pipe makes it add 2 extra processes with each call, making the number of processes grow exponentially instead of only linearly.

          Edit: Also, Im not at a computer to test this, but since the child is forked in the background (due to &), the parent is free to exit at that point, so your version would probably just effectively have 1-2 processes at a time, although the last one would have a new pid each time, so it would be impossible to get the pid and then kill it before it has already replaced itself. The original has the same “feature”, but with exponentially more to catch on each recursion. Each child would be reparented by pid 1, so you could kill them by killing pid 1 i guess (although you dont want to do that… and there would be a few you wouldn’t catch because they weren’t reparented yet)

        • @[email protected]
          link
          fedilink
          1
          edit-2
          7 months ago

          I may be wrong, but you could use : &;: & as well, but using the pipe reduces the amount of characters by two (or three, counting whitespace)

  • @[email protected]
    link
    fedilink
    28
    edit-2
    7 months ago

    Heh, haven’t seen the bash forkbomb in close to two decades… Thanks for the trip down memory lane! :)

    • Bizarroland
      link
      fedilink
      14
      edit-2
      7 months ago

      You know how I know I’ve gotten better at using linux?

      I saw the command and read it and figured out what it was although I’ve never been exposed to a fork bomb before in my life.

      I was like okay, this is an empty function that calls itself and then pipes itself back into itself? What the hell is going on?

      I will say that whoever invented this is definitely getting fucked by roko’s basilisk, though. The minute they thought of this it was too late for them.

      • @[email protected]
        link
        fedilink
        12
        edit-2
        7 months ago

        99.999% of that function’s effectiveness is that unix shell, being the ancient dinosaur it is, not just allows : as a function name but also uses the exact same declaration syntax for symbol and alphanumeric functions:

        foo(){ foo | foo& }; foo
        

        is way more obvious.

        EDIT: Yeah I give up I’m not going to try to escape that &

  • Ooops
    link
    fedilink
    227 months ago

    That’s not a cat but quite obviously a rabbit.

    • @[email protected]
      link
      fedilink
      English
      26
      edit-2
      7 months ago

      What that garble of symbols does, is that it defines and calls a function named :, which calls itself twice.

      The syntax for defining a function is different in Fish, so no, this particular garble will not work:

      But it is, of course, possible to write a (much more readable) version that will work in Fish.

      • @ReveredOxygen
        link
        English
        217 months ago

        you can write a more readable version in any shell, it’s intentionally unreadable

        • @[email protected]
          link
          fedilink
          11
          edit-2
          7 months ago

          Yeah, I meant, as an attacker, you couldn’t come up with a similarly unreadable version.

          At least, as far as I can tell, defining a function requires spelling out function and seems to require being defined on multiple lines, too.

      • @[email protected]
        link
        fedilink
        47 months ago

        But it is, of course, possible to write a (much more readable) version that will work in Fish.

        the gentleman hacker

        • @[email protected]
          link
          fedilink
          1
          edit-2
          7 months ago

          It hails back to the early days of the ampersand, from when it was basically still just Latin “et”: https://commons.wikimedia.org/wiki/File:Trebuchet_MS_ampersand.svg

          Personally, I do like this font (Fira Mono+Sans), because it still looks professional, without being so boring that I get depression from looking at it.
          But yeah, that ampersand is pushing it a bit, as I’m not sure everyone else knows that’s an ampersand…

      • @[email protected]
        link
        fedilink
        17 months ago

        Doesn’t work in nushell, function syntax is different.

        Probably still possible, just written differently.

  • Possibly linux
    link
    fedilink
    English
    177 months ago

    On a modern system it shouldn’t be that affected if you configure it right

  • @[email protected]
    link
    fedilink
    Español
    13
    edit-2
    7 months ago

    touch cat
    echo Oreo > cat
    cat cat

    Edit: for some reason mine’s saying Hydrox… results may vary.

  • @[email protected]
    link
    fedilink
    137 months ago

    It was a death sentence back then, but now I bet those with a threadripper with huge RAM can tank it until it hit ulimit.