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

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

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

    • steeznson@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      6 months ago

      In GNU coreutils the implementation of rm doesn’t allocate memory however I believe alternative implementations do.

      Here’s an example from the OpenBSD source code - https://github.com/openbsd/src/blob/222e275fb89ffb67abe0726dee2b107220092dc3/bin/rm/rm.c#L335

      Presumably other *BSDs use something similar? Didn’t check out FreeBSD or anything.

      Edit: So I suppose if you are using a BSD-type system (maybe including macOS?), and memory safety was important to you (to the point of extreme paranoia), then you might want to look into this rust project. Or just use the GNU implementation.

    • devraza@lemmy.mlOP
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      6 months ago

      I don’t know whether rm is memory-safe or not, but vpr is. By ‘memory-safe alternative’ I meant that this alternative is memory-safe, but not that rm isn’t.