“Anything that can be written in Rust will eventually be written in Rust”

  • radiant_bloom@lemm.ee
    link
    fedilink
    arrow-up
    38
    ·
    edit-2
    9 months ago

    Someone has to explain how rm, which doesn’t allocate any memory (as far as I can tell), isn’t memory safe ?

  • adr1an@programming.dev
    link
    fedilink
    arrow-up
    19
    ·
    9 months ago

    Can you share what would be a concrete example of the risk taken by running a RM program with a memory leak or dangling pointers? I fail to see, by my own ignorance, the benefit of memory safety everywhere. But I do enjoy the rust rewrites of shell tools because of the ergonomics, speed, and new functionalities. I’m asking because the first thing you mentioned as a benefit was memory safety.

    • Lodra@programming.dev
      link
      fedilink
      English
      arrow-up
      7
      ·
      9 months ago

      Unfortunately, I don’t remember the source so we may need to go digging. But I recall reading that something like 1/3 of all bugs are related to memory safety. And those bugs translate to things like buffer overflow and privilege escalation attacks.

      The proclaimed advantage is that by making the entirety of Rust memory safe, that entire class of bugs simply won’t exist for projects written in Rust. When they do happen, the bugs will be addressed by the language rather than many thousands of downstream projects. It should be an enormous gain in development performance for the world.

      I think the idea makes sense. Time will tell us how well that works.

    • devraza@lemmy.mlOP
      link
      fedilink
      arrow-up
      8
      arrow-down
      2
      ·
      edit-2
      9 months ago

      This probably isn’t the answer you’re looking for, but vpr being memory-safe isn’t a benefit that it has over rm, since rm apparently doesn’t allocate any memory (as @radiant_bloom@lemm.ee wrote).

      the first thing you mentioned as a benefit was memory safety.

      Looks like I worded my project description poorly. As I wrote in another comment, I meant that this alternative is memory-safe (being written in safe Rust), but not that rm isn’t.

      edit: I’ve updated the post’s title to clear things up

  • wyrmroot@programming.dev
    link
    fedilink
    arrow-up
    16
    ·
    9 months ago

    The README lacks a description of why I would choose this over rm. The name makes me think it might replace shred but that doesn’t appear to be the case.

  • merthyr1831@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    8 months ago

    To think that something i used to completely nuke my homeserver one time can be written in 112 lines of rust. thats the power of linux right there

    • devraza@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      8 months ago

      Well, I’m not sure how many lines of C rm is written in but I think that rm being only around 4kb (iirc) is something to consider.

      But still, storage probably matters least in this day and age. Oh, and…

      something I used to completely nuke my home server

      If I’m reading this right, then I hope you had backups ready :)

      • merthyr1831@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        8 months ago

        Lol thankfully i stopped before it ate any important info, but now I finally have all of that vital stuff being backed up to a hetzner storage box weekly now :)