• seaQueue@lemmy.world
    cake
    link
    fedilink
    arrow-up
    103
    arrow-down
    1
    ·
    4 months ago

    Gentoo users would be really mad about this if they weren’t still building their web browsers and could get online

  • henfredemars@infosec.pub
    link
    fedilink
    English
    arrow-up
    34
    ·
    4 months ago

    Why does this option without specifying a number of threads even exist? It might as well be footgun mode.

    • seaQueue@lemmy.world
      cake
      link
      fedilink
      arrow-up
      22
      ·
      4 months ago

      I’m pretty sure it’s “run as many threads as there are cores” mode, though if you’re running it in a terminal I always find it best to use nproc-1 or -2 so the machine actually stays usable.

    • Artyom@lemm.ee
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      4 months ago

      I don’t think I’ve ever used -j without specifying as many cores as I have, so it sounds completely reasonable.

    • MajorHavoc@programming.dev
      link
      fedilink
      arrow-up
      40
      ·
      edit-2
      4 months ago

      I believe the left hand is a shell fork-bomb, on the assumption that anything that zany is probably malicious.

      And the right hand is a way to tell Make to use up all available system resources:

      "-j [jobs]’ ¶
      ‘--jobs[=jobs]’
      Specifies the number of recipes (jobs) to run simultaneously. With no argument, make runs as many recipes simultaneously as possible. If there is more than one ‘-j’ option, the last one is effective. See Parallel Execution, for more information on how recipes are run. Note that this option is ignored on MS-DOS."
      

      Edit: I think the make command is technically only a problem when run for a Makefile that tries to do too many things, and has at least one mistake in dependency controls. So… for every Makefile I ever encountered (or that I ever wrote!)

      Yeah. They’re the same picture

      • Voroxpete
        link
        fedilink
        arrow-up
        26
        ·
        edit-2
        4 months ago

        You are correct, left hand is a fork bomb. Specifically, it creates and then runs a function named “:”. What this function does is pipe its output into itself while running in a background process, which instantly spawns infinite copies of itself. Technically I believe the : character could be any character as its just a name. The creator just picked a colon for aesthetics.

        • laurelraven@lemmy.blahaj.zone
          link
          fedilink
          arrow-up
          14
          ·
          4 months ago

          I always just kind of glazed over looking at that and just know “it’s a fork bomb” and basically what it does

          With your explanation, I can now actually understand all the parts and how they work, it actually makes sense

        • Mixel@feddit.de
          link
          fedilink
          arrow-up
          5
          ·
          4 months ago

          Now I get why it does what it does and how it works. I never thought that the colon was the variable name but it makes so much sense!

      • Max-P@lemmy.max-p.me
        link
        fedilink
        arrow-up
        6
        ·
        4 months ago

        I think it can also get weird when you call other makefiles, like if you go make -j64 at the top level and that thing goes on to call make on subprojects, that can be a looooot of threads of that -j gets passed down. So even on that 64 core machine, now you have possibly 4096 jobs going, and it surfaces bugs that might not have been a problem when we had 2-4 cores (oh no, make is running 16 jobs at once, the horror).

        • 0x4E4FOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          4 months ago

          There could also be other problems, like not being able to assign jobs correctly with that many threads. I’ve encountered this when assigning more jobs than there are threads on the rig. A lot more, like 2x, 4x the threads available.

        • 0x4E4FOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          4 months ago

          Yep.

          It’s a “heck, here’s all I got” switch.

          Remember, with great power comes great responsibility 😉.

    • 0x4E4FOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      Aaawww, that’s nice 😊.

    • 0x4E4FOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      I know the pain 😔… apparently, LLVM doesn’t like that my 4th gen i7 has only 32GB of RAM 🤨.