Skip to content
  • Hjem
  • Seneste
  • Etiketter
  • Populære
  • Verden
  • Bruger
  • Grupper
Temaer
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Kollaps
FARVEL BIG TECH
  1. Forside
  2. Ikke-kategoriseret
  3. The coreutils Rust rewrite story is pretty funny.

The coreutils Rust rewrite story is pretty funny.

Planlagt Fastgjort Låst Flyttet Ikke-kategoriseret
198 Indlæg 103 Posters 194 Visninger
  • Ældste til nyeste
  • Nyeste til ældste
  • Most Votes
Svar
  • Svar som emne
Login for at svare
Denne tråd er blevet slettet. Kun brugere med emne behandlings privilegier kan se den.
  • pikhq@social.treehouse.systemsP pikhq@social.treehouse.systems

    @lcamtuf and it's very worth remembering that while the design of rust _does_ prevent many bugs, it's not a get-out-of-bugs-free card. there are many ways to write code wrong, not just memory safety issues!

    argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
    argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
    argv_minus_one@mastodon.sdf.org
    wrote sidst redigeret af
    #83

    @pikhq

    Rust does also protect against data races.

    It does not, however, protect against file-system races.

    @lcamtuf

    1 Reply Last reply
    0
    • prozacchiwawa@functional.cafeP prozacchiwawa@functional.cafe

      @lcamtuf i do find that the crates dedicated to atomic file handling and temp files, in the interest of providing a uniform platform interface aren't as good as what's reachable in c.

      it's not a fault of the rust language per se, but writing a safe interface at that level isn't easy, so it makes sense (and is in some sense a better default) to have high level, platform neutral access here.

      argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
      argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
      argv_minus_one@mastodon.sdf.org
      wrote sidst redigeret af
      #84

      @prozacchiwawa

      Could you elaborate on this? What exactly is lacking in e.g. the tempfile crate? If it were for Linux only, in what ways would it be better?

      @lcamtuf

      1 Reply Last reply
      0
      • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

        The coreutils Rust rewrite story is pretty funny.

        Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

        But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

        https://seclists.org/oss-sec/2026/q2/332

        PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

        baloouriza@social.tulsa.ok.usB This user is from outside of this forum
        baloouriza@social.tulsa.ok.usB This user is from outside of this forum
        baloouriza@social.tulsa.ok.us
        wrote sidst redigeret af
        #85

        @lcamtuf I legitimately wonder what it is about Rust that inspires people to start questionable porting projects in the first place. Like, who asked for coreutils in Rust?

        taschenorakel@mastodon.greenT 1 Reply Last reply
        0
        • hyc@mastodon.socialH hyc@mastodon.social

          @lcamtuf See this all the time - people storm in trying to change things before trying to understand how the current things work. People who don't learn from what's been done before. Society doesn't progress from efforts like theirs. You only make progress by learning from and building on top of what came before.

          argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
          argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
          argv_minus_one@mastodon.sdf.org
          wrote sidst redigeret af
          #86

          @hyc

          Even if you do tear down what came before and replace it entirely, you still need to understand how the thing you're replacing works, or else your replacement will be worse because you'll make the same mistakes your predecessors did.

          Those who fail to learn from history are doomed to repeat it, after all.

          @lcamtuf

          hyc@mastodon.socialH 1 Reply Last reply
          0
          • oblomov@sociale.networkO oblomov@sociale.network

            @sten @lcamtuf

            MIT licensing vs GPL.

            (I'm not joking.)

            argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
            argv_minus_one@mastodon.sdf.orgA This user is from outside of this forum
            argv_minus_one@mastodon.sdf.org
            wrote sidst redigeret af
            #87

            @oblomov

            What the hell for? Was Canonical planning on making a Proprietary Enterprise Coreutils? 🤨

            @sten @lcamtuf

            1 Reply Last reply
            0
            • josh@hactivedirectory.comJ josh@hactivedirectory.com

              @ChuckMcManis I actually find questioning the why behind something to be important. In your experience at Google, did the devs rewriting things have _access_ to the documentation as to why something was done? Was it like disbelief of the stated facts or were there holes in the notetaking about the reasoning?

              @darkuncle @lcamtuf

              chuckmcmanis@chaos.socialC This user is from outside of this forum
              chuckmcmanis@chaos.socialC This user is from outside of this forum
              chuckmcmanis@chaos.social
              wrote sidst redigeret af
              #88

              @josh To be clear, all the source code, a wiki of discussions, etc was available to everyone who wrote code at the time. I recall pushing back one such occasion and asking if the project lead knew *why* the current code did what it did, and they stated, and I quote because it stuck with me, "It doesn't matter why, because I've rewritten all of it and I know why I wrote what I did."

              To understand that you have to understand Google dev culture at the time. 1/2

              @darkuncle @lcamtuf

              chuckmcmanis@chaos.socialC 1 Reply Last reply
              0
              • argv_minus_one@mastodon.sdf.orgA argv_minus_one@mastodon.sdf.org

                @hyc

                Even if you do tear down what came before and replace it entirely, you still need to understand how the thing you're replacing works, or else your replacement will be worse because you'll make the same mistakes your predecessors did.

                Those who fail to learn from history are doomed to repeat it, after all.

                @lcamtuf

                hyc@mastodon.socialH This user is from outside of this forum
                hyc@mastodon.socialH This user is from outside of this forum
                hyc@mastodon.social
                wrote sidst redigeret af
                #89

                @argv_minus_one @lcamtuf my point exactly

                1 Reply Last reply
                0
                • ireneista@adhd.irenes.spaceI ireneista@adhd.irenes.space

                  @lcamtuf yeah it's frustrating because in some sense we all had the opportunity to learn this lesson, a long time ago

                  we remember when we were kids, after Netscape went bankrupt trying to re-write their software from scratch, there were some good essays analyzing what went wrong and advocating for refactoring instead so as not to lose the knowledge that's in the code

                  and then there's the ATC system

                  like... there's so many past instances to learn from

                  P This user is from outside of this forum
                  P This user is from outside of this forum
                  pinskia@hachyderm.io
                  wrote sidst redigeret af
                  #90

                  @ireneista @lcamtuf

                  "Netscape went bankrupt trying to re-write their software from scratch"

                  It is also why Microsoft Edge went from something written from scratch to be a fork of chromium. The story is the same and even more it is about the similar product. Plus it is a recent example of the whole starting from scratch issues.

                  lispi314@udongein.xyzL ingalovinde@embracing.spaceI 2 Replies Last reply
                  0
                  • doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                    doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                    doomed_daniel@mastodon.gamedev.place
                    wrote sidst redigeret af
                    #91

                    @ireneista @lcamtuf
                    Additional fun thought: I can imagine they avoided looking at the GNU coreutils C implementation because they are using MIT license instead of GPL.

                    1 Reply Last reply
                    0
                    • chuckmcmanis@chaos.socialC chuckmcmanis@chaos.social

                      @josh To be clear, all the source code, a wiki of discussions, etc was available to everyone who wrote code at the time. I recall pushing back one such occasion and asking if the project lead knew *why* the current code did what it did, and they stated, and I quote because it stuck with me, "It doesn't matter why, because I've rewritten all of it and I know why I wrote what I did."

                      To understand that you have to understand Google dev culture at the time. 1/2

                      @darkuncle @lcamtuf

                      chuckmcmanis@chaos.socialC This user is from outside of this forum
                      chuckmcmanis@chaos.socialC This user is from outside of this forum
                      chuckmcmanis@chaos.social
                      wrote sidst redigeret af
                      #92

                      @josh

                      Dev culture was one long series of "dick measurements" as one engineer put it. That was because of how Google evaluated engineers and how reviews got written. How that emerged in practice was that saying "I don't know" was like saying "fire me now" to a lot of these kids. So they couldn't introspect at all in front of others. I was not popular (as you might guess) for asking "rude" questions. 😃 But I also didn't care if Google chose to fire me so there was that. 2/2

                      @darkuncle @lcamtuf

                      darkuncle@infosec.exchangeD 1 Reply Last reply
                      0
                      • fogti@chaos.socialF This user is from outside of this forum
                        fogti@chaos.socialF This user is from outside of this forum
                        fogti@chaos.social
                        wrote sidst redigeret af
                        #93

                        @ireneista @lcamtuf I think in this case it would've been possible to properly rewrite hem one by one, but the metric appears to be more a quantity-over-quality "lets get this out of the door quickly", i.e. the incentives weren't placed right.

                        hllizi@hespere.deH 1 Reply Last reply
                        0
                        • z3r0@gts.maverick-hq.orgZ z3r0@gts.maverick-hq.org

                          @lcamtuf I've heard a lot of funny stories like this in previous years. Like for example a startup trying to rewrite the TCP stack by their own from scratch because they can do it more efficient.
                          Soon they learned how a real environment, or better said, the real life really is.

                          bob_zim@infosec.exchangeB This user is from outside of this forum
                          bob_zim@infosec.exchangeB This user is from outside of this forum
                          bob_zim@infosec.exchange
                          wrote sidst redigeret af
                          #94

                          @z3r0 @lcamtuf Not just startups. Microsoft rewrote most of the network stack in what eventually became Vista. They managed to reintroduce Teardrop and a lot of other basic issues. It was eventually a good decision, but it took a while to get there.

                          1 Reply Last reply
                          0
                          • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

                            The coreutils Rust rewrite story is pretty funny.

                            Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

                            But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

                            https://seclists.org/oss-sec/2026/q2/332

                            PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

                            jrose@social.belkadan.comJ This user is from outside of this forum
                            jrose@social.belkadan.comJ This user is from outside of this forum
                            jrose@social.belkadan.com
                            wrote sidst redigeret af
                            #95

                            @lcamtuf @regehr

                            isn't a fertile ground for memory safety bugs

                            Mm. Another write-up, admittedly on a pro-Rust site, collected the recent GNU coreutils CVEs and they do seem to still be having memory safety bugs even after X decades of development. Are these as bad as TOCTOU bugs? Probably not, but I'm not sure "start over from scratch" comes off as poorly with these stats. https://corrode.dev/blog/bugs-rust-wont-catch/#what-rust-did-prevent

                            1 Reply Last reply
                            0
                            • puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                              puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                              puppygirlhornypost2@transfem.social
                              wrote sidst redigeret af
                              #96

                              @ireneista@adhd.irenes.space @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place Well there's always the ability for clean room implementation, no?

                              puppygirlhornypost2@transfem.socialP 1 Reply Last reply
                              0
                              • puppygirlhornypost2@transfem.socialP puppygirlhornypost2@transfem.social

                                @ireneista@adhd.irenes.space @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place Well there's always the ability for clean room implementation, no?

                                puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                puppygirlhornypost2@transfem.social
                                wrote sidst redigeret af
                                #97

                                @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space I will admit it does sound extremely stupid to cleanroom implement coreutils but at the same time I feel like that could have mitigated some of the issue here.

                                1 Reply Last reply
                                0
                                • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

                                  The coreutils Rust rewrite story is pretty funny.

                                  Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

                                  But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

                                  https://seclists.org/oss-sec/2026/q2/332

                                  PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

                                  aburka@hachyderm.ioA This user is from outside of this forum
                                  aburka@hachyderm.ioA This user is from outside of this forum
                                  aburka@hachyderm.io
                                  wrote sidst redigeret af
                                  #98

                                  @lcamtuf they did a writeup here https://corrode.dev/blog/bugs-rust-wont-catch/#what-rust-did-prevent

                                  to be fair, the original uutils may not be a hotbed of memory safety bugs but the linked section cites a bunch

                                  1 Reply Last reply
                                  0
                                  • puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                    puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                    puppygirlhornypost2@transfem.social
                                    wrote sidst redigeret af
                                    #99

                                    @Doomed_Daniel@mastodon.gamedev.place @lcamtuf@infosec.exchange @ireneista@adhd.irenes.space I think you mistook musl for BusyBox. I did the same thing in my head. (musl is an MIT-licensed C standard library implementation) It appears BusyBox (alternative to gnu coreutils) is also licensed under GPLv2, unfortunately.

                                    1 Reply Last reply
                                    0
                                    • icing@chaos.socialI icing@chaos.social

                                      @david_chisnall @lcamtuf Try to write to C++ ‚cout‘ concurrently. Complete clown fiesta!🤡

                                      petersommerlad@mastodon.socialP This user is from outside of this forum
                                      petersommerlad@mastodon.socialP This user is from outside of this forum
                                      petersommerlad@mastodon.social
                                      wrote sidst redigeret af
                                      #100

                                      using std::cout concurrently does not cause data races (no UB). If youvwant to get output readably together use std::osyncstream wrapper around the global object or any other shared ostream object.

                                      1 Reply Last reply
                                      0
                                      • puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                        puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                        puppygirlhornypost2@transfem.social
                                        wrote sidst redigeret af
                                        #101

                                        @Seirdy@pleroma.envs.net @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space one of the things you notice when you're using MacOS, FreeBSD etc... they parse arguments differently. They don't rely on getopt_long (GNU's getopt shit) and so you end up with situations like

                                        rm -rf ./shitass -v

                                        not running because -v is an unknown file, and it expects the arguments before.

                                        puppygirlhornypost2@transfem.socialP orca@nya.oneO 2 Replies Last reply
                                        0
                                        • puppygirlhornypost2@transfem.socialP puppygirlhornypost2@transfem.social

                                          @Seirdy@pleroma.envs.net @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space one of the things you notice when you're using MacOS, FreeBSD etc... they parse arguments differently. They don't rely on getopt_long (GNU's getopt shit) and so you end up with situations like

                                          rm -rf ./shitass -v

                                          not running because -v is an unknown file, and it expects the arguments before.

                                          puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                          puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                          puppygirlhornypost2@transfem.social
                                          wrote sidst redigeret af
                                          #102

                                          @lcamtuf@infosec.exchange @Seirdy@pleroma.envs.net @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space like it's really kinda fascinating in a way, but also immensely frustrating if you were used to "gnuisms".

                                          seirdy@pleroma.envs.netS puppygirlhornypost2@transfem.socialP 2 Replies Last reply
                                          0
                                          Svar
                                          • Svar som emne
                                          Login for at svare
                                          • Ældste til nyeste
                                          • Nyeste til ældste
                                          • Most Votes


                                          • Log ind

                                          • Har du ikke en konto? Tilmeld

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          Graciously hosted by data.coop
                                          • First post
                                            Last post
                                          0
                                          • Hjem
                                          • Seneste
                                          • Etiketter
                                          • Populære
                                          • Verden
                                          • Bruger
                                          • Grupper