News for hackers. Stuff that matters.
Re:Bzip2 crate switches from C to 100% rust by dralley on Tuesday June 17, 2025 @05:53PM (#44304362)
How realistic is it for the Trifecta Tech implementation to start displacing the "official" implementation used by linux distros, which hasn't seen an upstream release since 2019?

Fedora recently swapped the original Adler zlib implementation with zlib-ng, so that sort of thing isn't impossible. You just need to provide a C ABI compatible with the original one.

Re:Bzip2 crate switches from C to 100% rust by tiffanyh on Tuesday June 17, 2025 @08:10PM (#44305365)
I think that is the goal of uutils.

https://uutils.github.io/

Re:Bzip2 crate switches from C to 100% rust by cocoa19 on Tuesday June 17, 2025 @10:02PM (#44306009)
I hope some are improved too.

The performance boost in tools like ripgrep and tokei is insane compared to the tools they replace (grep and cloc respectively).

Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @05:54AM (#44308313)
I absolutely hate it when people call their tools a "replacement" for something that is part of core standards, something, that did just fine for decades.

ripgrep is an excellent tool. But it's not a grep replacement. And should not ever be.

Re:Bzip2 crate switches from C to 100% rust by mprovost on Wednesday June 18, 2025 @06:06AM (#44308387)
The GNU utils were a replacement for the BSD utils which were a replacement for the original AT&T utils. Every replacement added new functionality and improvements, and every time someone complained that they didn't stick closer to the thing they replaced. Looking specifically at grep, there used to be new versions like egrep and fgrep that added functionalities beyond standard grep's, but those were eventually pulled into "standard" grep (GNU or BSD). If we stuck with standards we'd all still be using the Bourne shell. The GNU utilities have been around long enough that they feel like the standard now, but I'm glad that we're coming into a new phase of innovation in command-line utilities. And this didn't start with Rust - the new generation of search utilities started with ack (Perl) and then ag (C).
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @06:31AM (#44308555)
> we'd all still be using the Bourne shell

Please forgive me my ignorance but what's wrong with bash? I'm still using it on all servers and workstations, I constantly write scripts for it, some fairly complex. It's not an obsolete project and it looks like a mainstream shell for me. Am I wrong?

Update: yeah, I realize now that this was about the original Bourne Shell, not bash.

Re:Bzip2 crate switches from C to 100% rust by dagw on Wednesday June 18, 2025 @06:35AM (#44308588)
Bash is not Bourne, and that's the point. Bash is the Bourne Again Shell, a shell written to improve and replace the Bourne shell in the GNU ecosystem. Modern bash is a huge improvement over the original Bourne shell and I'm convinced you use bash only feature basically every day, and would be very annoyed if someone forced you to use the actual Bourne shell
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @06:40AM (#44308633)
Ah, right! I do remember the original Bourne Shell, though. I wouldn't like to get back to using it. Though I might agree provided I get as many years of my age back.
Re:Bzip2 crate switches from C to 100% rust by mprovost on Wednesday June 18, 2025 @06:40AM (#44308641)
Bash isn't the Bourne shell (sh)! It's a replacement (Bourne Again Shell). But it's interesting that the replacement has become so entrenched that folk assume that it was the original.
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @06:47AM (#44308676)
Yeah, got it now lol
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @06:32AM (#44308567)
> which were a replacement for the

You have a point here. I have to agree.

"X but rewritten in Z" is a terrible marketing, though. Makes me instantly want to hate the tool and its authors. (Love rust. Hate the vibe).

Re:Bzip2 crate switches from C to 100% rust by mprovost on Wednesday June 18, 2025 @07:10AM (#44308806)
Why the hate? It's a genuine question. When you rewrite something, you need to justify the effort somehow. The GNU coreutils started out as "the BSD utilities, but with the GPL!".
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @10:09AM (#44310050)
Because the reimplementation authors skip all the complexities of designing the tool in the first place while getting right to the fun part (which is coding), and then they get to call themselves authors of a well known infrastructure tool.

Compare "I have typed a setuid() wrapper in rust" vs "I'm the author of sudo-rs".

Re:Bzip2 crate switches from C to 100% rust by scripturial on Wednesday June 18, 2025 @09:17AM (#44309638)
It’s a rust crate designed to be a native rust replacement for a rust c wrapper crate. It’s faster and easier to link to in rust projects.

How would you even tell people you made a better rust crate without using the word “rust?”

Re:Bzip2 crate switches from C to 100% rust by throwawaymaths on Wednesday June 18, 2025 @10:33AM (#44310256)
you would say "rewritten FOR rust" instead of "rewritten IN rust".
Re:Bzip2 crate switches from C to 100% rust by scripturial on Wednesday June 18, 2025 @11:57AM (#44311004)
It’s a rust crate that depended on c and is now literally “rewritten in rust”
Re:Bzip2 crate switches from C to 100% rust by throwawaymaths on Wednesday June 18, 2025 @12:28PM (#44311258)
> rust crate
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @10:12AM (#44310083)
Why not spend the efforts to speed up the real zlib? So that the whole world actually gets to spin a bit faster.

Rust folks are claiming excellent interoperability with C binaries. Why the need for a rewrite then?

Re:Bzip2 crate switches from C to 100% rust by swiftcoder on Wednesday June 18, 2025 @10:45AM (#44310363)
Maybe because the speed up is easier to attain in a language where you aren't constantly worrying about introducing bugs? Maybe development is easier in a language with more modern tooling?

Interoperability runs both ways, everyone currently taking a dependency on the C library can swap in the rust library in its place and see the same benefits

Re:Bzip2 crate switches from C to 100% rust by hulitu on Thursday June 19, 2025 @03:22AM (#44316323)
> If we stuck with standards we'd all still be using the Bourne shell

or Korn shell.

Re:Bzip2 crate switches from C to 100% rust by burntsushi on Wednesday June 18, 2025 @06:17AM (#44308460)
I didn't call ripgrep a replacement. Other people do. Because it does actually replace their usage of grep in some or all cases, depending on their usage patterns.

https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#can...

Re:Bzip2 crate switches from C to 100% rust by dagw on Wednesday June 18, 2025 @06:27AM (#44308525)
And should not ever be.

Those "core standards" that you talk about didn't spring fully formed from the earth. They came about from competition and beating out and replacing the old "core standards" that lots of people argued very strongly for should not ever be replaced. When I was starting out my career I was told by experienced people that I should not learn to rely on the GNU tool features, since they're far from ubiquitous and probably won't be installed on most systems I'll be working on.

Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @06:34AM (#44308581)
That's right and still true: GNU tools are still not ubiquitous on mainstream computers. And I'm not talking about that Ultrix box still churning. For example the latest macOS carries bsd tar, so.
Re:Bzip2 crate switches from C to 100% rust by jelder on Wednesday June 18, 2025 @06:47AM (#44308680)
I hadn't heard of tokei before, so I tried it on a small project of mine.

Tokei _finishes_ before cloc can print its help text. I wrote this post in less time than it took `cloc .` to count all the files in my project, probably because it doesn't know to ignore `target/`.

Re:Bzip2 crate switches from C to 100% rust by arp242 on Wednesday June 18, 2025 @09:31AM (#44309747)
> Tokei _finishes_ before cloc can print its help text.

cloc is a Perl script, so it has the interpreter startup time.

Re:Bzip2 crate switches from C to 100% rust by coldpie on Wednesday June 18, 2025 @09:48AM (#44309864)
1) This is a cool project and I wish them success. It would be really cool if these became the default utilities some day soon.

2) I think the MIT license was a mistake. These are often cloning GNU utilities, so referencing GNU source in its original language and then re-implementing it in Rust would be the obvious thing to do. But porting GPL-licensed code to an MIT licensed project is not allowed. Instead, the utilities must be re-implemented from scratch, which seems like a waste of effort. I would be interested in doing the work of porting GNU source to Rust, but I'm not interested in re-writing them all from scratch, so I haven't contributed to this project.

Re:Bzip2 crate switches from C to 100% rust by hueho on Wednesday June 18, 2025 @10:12AM (#44310076)
Plenty of people dislike the perceived bload in GNU utils - for them a rewrite from scratch is a feature, not a bug.
Re:Bzip2 crate switches from C to 100% rust by monster_truck on Wednesday June 18, 2025 @10:21AM (#44310158)
What's the point of mentioning you suspect it is happening other than as a dig at them?
Re:Bzip2 crate switches from C to 100% rust by coldpie on Wednesday June 18, 2025 @10:31AM (#44310235)
You're 100% right. I removed it.
Re:Bzip2 crate switches from C to 100% rust by Scuds on Thursday June 19, 2025 @11:45AM (#44319734)
"Seems like a waste of effort" in a vacuum yes, but

1 - GNU utilities is ancient crufty #IFDEF'd C that's been in maintenance mode for decades. You want code to handle quirks of Tru64 and Ultrix? You got it.

2 - Waving your hands around 'the community will take care of it' is magical thinking. C developers don't grow on trees. C tooling is kinda weird and doesn't resemble anything modern - good luck finding enough VOLUNTEER C developers to make your goals happen.

Re:Bzip2 crate switches from C to 100% rust by wmf on Tuesday June 17, 2025 @06:57PM (#44304918)
Ubuntu is using Rust sudo so it's definitely possible.
Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @05:50AM (#44308292)
It's not. At least not yet. It's planned for 25.10, but thankfully sudo will be packaged and available for a few versions after that as promised [1].

[1] https://discourse.ubuntu.com/t/adopting-sudo-rs-by-default-i...

Re:Bzip2 crate switches from C to 100% rust by masfuerte on Tuesday June 17, 2025 @06:01PM (#44304440)
They do provide a compatible C ABI. Someone "just" needs to do the work to make it happen.
Re:Bzip2 crate switches from C to 100% rust by rlpb on Tuesday June 17, 2025 @06:14PM (#44304544)
> You just need to provide a C ABI compatible with the original one.

How does this interact with dynamic linking? Doesn't the current Rust toolchain mandate static linking?

Re:Bzip2 crate switches from C to 100% rust by sedatk on Tuesday June 17, 2025 @06:16PM (#44304562)
Re:Bzip2 crate switches from C to 100% rust by arcticbull on Tuesday June 17, 2025 @06:16PM (#44304563)
Rust lets you generate dynamic C-linkage libraries.

Use crate-type=["cdylib"]

Re:Bzip2 crate switches from C to 100% rust by nicoburns on Tuesday June 17, 2025 @06:40PM (#44304758)
Dynamic linking works fine if you target the C ABI.
Re:Bzip2 crate switches from C to 100% rust by timeon on Tuesday June 17, 2025 @07:23PM (#44305052)
You can use dynamic linking in Rust with C ABI. Which means going through `unsafe` keyword - also known as 'trust me bro'. Static linking directly to Rust source means it is checked by compiler so there is no need for unsafe.
Re:Bzip2 crate switches from C to 100% rust by bluGill on Tuesday June 17, 2025 @08:31PM (#44305496)
Rust cannot dynamic link to rust. It can dynamic link to C and be dynamicly linked by C - if you combine the two you can cheat but it is still C that you are dealing with not rust even if rust is on both sides.
Re:Bzip2 crate switches from C to 100% rust by mjevans on Tuesday June 17, 2025 @09:52PM (#44305948)
It might help to think of it as two IPC 'servers' written in rust that happen to have the C ABI interfaces as their communication protocol.
Re:Bzip2 crate switches from C to 100% rust by filmor on Wednesday June 18, 2025 @01:33AM (#44306916)
Rust can absolutely link to Rust libraries dynamically. There is no stable ABI, so it has to be the same compiler version, but it will still be dynamically linked.
Re:Bzip2 crate switches from C to 100% rust by conradev on Tuesday June 17, 2025 @08:41PM (#44305557)
Rust importing Rust must be statically linked, yes. You can statically link Rust into a dynamic library that other libraries link to, though!
Re:Bzip2 crate switches from C to 100% rust by alxhill on Tuesday June 17, 2025 @09:07PM (#44305686)
The commenters below are confusing two things - Rust binaries can be dynamically linked, but because Rust doesn’t have a stable ABI you can’t do this across compiler versions the way you would with C. So in practice, everything is statically linked.
Re:Bzip2 crate switches from C to 100% rust by quotemstr on Wednesday June 18, 2025 @12:14AM (#44306601)
C++ binaries should be doing the same. Externally, speak C ABI. Internally, statically link Rust stdlib or C++ stdlib.
Re:Bzip2 crate switches from C to 100% rust by pjmlp on Wednesday June 18, 2025 @04:02AM (#44307666)
OWL, MFC, Qt, VCL, FireMonkey, AppFramework, PowerPlant...

Plenty do not, especially on Apple and Microsoft platforms because they always favoured other approaches to bare bones UNIX support on their dynamic linkers, and C++ compilers.

Re:Bzip2 crate switches from C to 100% rust by pjc50 on Wednesday June 18, 2025 @04:48AM (#44307968)
Exporting a C API from a C++ project to consume in another C++ project is really painful. This is how you get COM.

(which actually slightly pre-dates C++, I think?)

Re:Bzip2 crate switches from C to 100% rust by Someone on Wednesday June 18, 2025 @09:48AM (#44309861)
> This is how you get COM. (which actually slightly pre-dates C++, I think?)

No. C++ is from 1985 (https://en.wikipedia.org/wiki/C%2B%2B), COM from 1993 (https://en.wikipedia.org/wiki/Component_Object_Model)

Re:Bzip2 crate switches from C to 100% rust by quotemstr on Wednesday June 18, 2025 @11:30AM (#44310774)
COM is actually good though. Or if you want another object system, you can go with GObject, which works fine with Rust, C-+, Python, JavaScript, and tons of other things.
Re:Bzip2 crate switches from C to 100% rust by eru on Tuesday June 17, 2025 @09:26PM (#44305802)
Static linking also produces smaller binaries and lets you do link-time-optimisation.
Re:Bzip2 crate switches from C to 100% rust by emidln on Wednesday June 18, 2025 @02:12AM (#44307074)
Static linking doesn't produce smaller binaries. You are literally adding the symbols from a library into your executable rather than simply mentioning them and letting the dynamic linker figure out how to map those symbols at runtime.

The sum size of a dynamic binary plus the dynamic libraries may be larger than one static linked binary, but whether that holds for more static binaries (2, 3, or 100s) depends on the surface area your application uses of those libraries. It's relatively common to see certain large libraries only dynamically linked, with the build going to great lengths to build certain libraries as shared objects with the executables linking them using a location-relative RPATH (using the $ORIGIN feature) to avoid the extra binary size bloat over large sets of binaries.

Re:Bzip2 crate switches from C to 100% rust by IshKebab on Wednesday June 18, 2025 @02:50AM (#44307277)
Static linking does produce smaller binaries when you bundle dependencies. You're conflating two things - static vs dynamic linking, and bundled vs shared dependencies.

They are often conflated because you can't have shared dependencies with static linking, and bundling dynamically linked libraries is uncommon in FOSS Linux software. It's very common on Windows or with commercial software on Linux though.

Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @03:40AM (#44307525)
You know how the page cache works? Static linking makes it not work. So 3000 processes won't share the same pages for the libc but will have to load it 3000 times.
Re:Bzip2 crate switches from C to 100% rust by mandarax8 on Wednesday June 18, 2025 @03:56AM (#44307615)
You can still statically link all your own code but dynamically link libc/other system dependencies.
Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @04:24AM (#44307823)
Not with rust…
Re:Bzip2 crate switches from C to 100% rust by tialaramex on Wednesday June 18, 2025 @05:59AM (#44308345)
I wonder what happens in the minds of people who just flatly contradict reality. Are they expecting others to go "OK, I guess you must be correct and the universe is wrong"? Are they just trying to devalue the entire concept of truth?

[In case anybody is confused by your utterance, yes of course this works in Rust]

Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @06:34AM (#44308579)
Can you run ldd on any binary you currently have on your machine that is written in rust?

I eagerly await the results!

Re:Bzip2 crate switches from C to 100% rust by whytevuhuni on Wednesday June 18, 2025 @07:47AM (#44309036)
I’m genuinely curious now, what made you so convinced that it would be completely statically linked?
Re:Bzip2 crate switches from C to 100% rust by IshKebab on Wednesday June 18, 2025 @08:43AM (#44309399)
I think people often talk about Rust only supporting static linking so he probably inferred that it couldn't dynamically link with anything.

Also Go does produce fully static binaries on Linux and so it's at least reasonable to incorrectly guess that Rust does the same.

Definitely shouldn't be so confident though!

Re:Bzip2 crate switches from C to 100% rust by CamouflagedKiwi on Wednesday June 18, 2025 @10:20AM (#44310146)
Go may or may not do that on Linux depending what you import. If you call things from `os/user` for example, you'll get a dynamically linked binary unless you build with `-tags osusergo`. A similar case exists for `net`.
Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @04:43PM (#44313129)
go by default links libc
Re:Bzip2 crate switches from C to 100% rust by IshKebab on Thursday June 19, 2025 @08:05AM (#44317864)
It doesn't. See the sibling comment.
Re:Bzip2 crate switches from C to 100% rust by tux3 on Wednesday June 18, 2025 @07:00AM (#44308740)
I mean, sure, but what's your point?

Here's nu, a shell in Rust:

    $ ldd ~/.cargo/bin/nu
        linux-vdso.so.1 (0x00007f473ba46000)
        libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f47398f2000)
        libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f4739200000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f473b9cd000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4739110000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4738f1a000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f473ba48000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f473b9ab000)
        libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f4738e50000)
And here's the Debian variant of ash, a shell in C:

    $ ldd /bin/sh     
        linux-vdso.so.1 (0x00007f88ae6b0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f88ae44b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f88ae6b2000)
Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @08:20AM (#44309236)
Well seems I was wrong about linking C libraries from rust.

The problem of increased RAM requirements and constant rebuilds are still very real, if only slightly less big because of dynamically linking C.

Re:Bzip2 crate switches from C to 100% rust by bronson on Wednesday June 18, 2025 @10:18AM (#44310134)
That would have been a good post if you'd stopped at the first paragraph.

Your second paragraph is either a meaningless observation on the difference between static and dynamic linking or also incorrect. Not sure what your intent was.

Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @03:00PM (#44312423)
Why do facts offend you?
Re:Bzip2 crate switches from C to 100% rust by IshKebab on Wednesday June 18, 2025 @08:42AM (#44309387)
Kind of off-topic. But yeah it's a good idea for operating systems to guarantee the provision of very commonly used libraries (libc for example) so that they can be shared.

Mac does this, and Windows pretty much does it too. There was an attempt to do this on Linux with the Linux Standard Base, but it never really worked and they gave up years ago. So on Linux if you want a truly portable application you can pretty much only rely on the system providing very old versions of glibc.

Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @03:00PM (#44312420)
The standard library is the whole distro :)

It's hardly a fair comparison with old linux distros when osx certainly will not run anything old… remember they dropped rosetta, rosetta2, 32bit support, opengl… (list continues).

And I don't think you can expect windows xp to run binaries for windows 11 either.

So I don't understand why you think this is perfectly reasonable to expect on linux, when no other OS has ever supported it.

Care to explain?

Re:Bzip2 crate switches from C to 100% rust by guappa on Wednesday June 18, 2025 @03:39AM (#44307513)
Static linking produces huge binaries, it lets you do LTO but the amount of optimisation you can actually do is limited by your RAM. Static linking also causes the entire archive to need constant rebuilds.
Re:Bzip2 crate switches from C to 100% rust by TuxSH on Wednesday June 18, 2025 @08:36AM (#44309339)
You don't need LTO to trim static binaries (though LTO will do it), `-ffunction-sections -fdata-sections` in compiler flags combined with `--gc-section` (or equivalent) in linker flags will do it.

This way you can get small binaries with readable assembly.

Re:Bzip2 crate switches from C to 100% rust by eru on Thursday June 19, 2025 @07:39PM (#44323523)
> Static linking also causes the entire archive to need constant rebuilds.

Only relinking, which you can make cheap for your non-release builds.

Dynamic linking needs relinking everytime you run the program!

Re:Bzip2 crate switches from C to 100% rust by connicpu on Tuesday June 17, 2025 @09:39PM (#44305874)
Specifically, the rust dependencies are statically linked. It's extremely easy to dynamically link anything that has a C ABI from rust.
Re:Bzip2 crate switches from C to 100% rust by pjmlp on Wednesday June 18, 2025 @04:04AM (#44307686)
A culture isse, as in the C++ world, of Apple and Microsoft ecosystems, shipping binary C++ libraries is a common business, even it is compiler version dependent.

This is why Apple made such a big point of having a better ABI approach on Swift, after their experience with C++ and Objective-C.

While on Microsoft side, you will notice that all talks from Victor Ciura on Rust conferences have dealing with ABI as one of the key points Microsoft is dealing with in the context of Rust adoption.

Re:Bzip2 crate switches from C to 100% rust by zozbot234 on Wednesday June 18, 2025 @06:41AM (#44308646)
Rust's stable ABI is the C ABI. So you absolutely can dynamically link a Rust-written binary and/or a Rust-written shared library, but the interface has to be pure C. (This also gives you free FFI to most other programming languages.) You can use lightweight statically-linked wrappers to convert between Rust and C interfaces on either side and preserve some practical safety.
Re:Bzip2 crate switches from C to 100% rust by Someone on Wednesday June 18, 2025 @09:44AM (#44309833)
> but the interface has to be pure C. (This also gives you free FFI to most other programming languages.)

Easy, not free. In many languages, extra work is needed to provide a C interface. Strings may have to be converted to zero terminated byte arrays, memory that can be garbage collected may have to be locked, structs may mean having to be converted to C struct layout, etc.

Re:Bzip2 crate switches from C to 100% rust by deknos on Wednesday June 18, 2025 @02:40AM (#44307217)
i wait until they come to the hard stuff like awk, sed and grep.
Re:Bzip2 crate switches from C to 100% rust by GuB-42 on Wednesday June 18, 2025 @04:23AM (#44307812)
ripgrep is one of the best grep replacement you can find, maybe even the best, and also one of the most famous Rust projects.

I don't know of a sed equivalent, but I guess that would be easy to implement as Rust has good regex support (see ripgrep), and 90%+ of sed usage is search-and-replace. The other commands don't look hard to implement and because they are not used as much, optimizing these is less of a priority.

I don't know about awk, it is a full programming language, but I guess it is far from an impossible task to implement.

Now the real hard part is making a true, bug-for-bug compatible replacement of the GNU version of these tools, but while good to have, it is not strictly necessary. For example, Busybox is very popular, maybe even more so than GNU in terms of number of devices, and it has its own (likely simplified) version of grep, sed and awk.

Re:Bzip2 crate switches from C to 100% rust by scns on Wednesday June 18, 2025 @06:06AM (#44308392)
There is sd, not a drop in replacement though.

https://github.com/chmln/sd

Re:Bzip2 crate switches from C to 100% rust by egorfine on Wednesday June 18, 2025 @05:54AM (#44308318)
What would be the point?
Re:Bzip2 crate switches from C to 100% rust by kpcyrd on Wednesday June 18, 2025 @06:23AM (#44308504)
I briefly looked a this and there's already cargo-c configuration, which is good, but it's currently namespaced differently, so it won't get automatically detected by C programs as `libbz2`:

https://github.com/trifectatechfoundation/libbzip2-rs/blob/8...

I'm not familiar enough with the symbols of bzip2 to say anything about ABI compatibility.

I have a toy project to explore things like that, but it's difficult to set aside the amount of time needed to maintain an implementation of the GNU operating system. I would welcome pull requests though:

https://github.com/kpcyrd/platypos

Re:Bzip2 crate switches from C to 100% rust by Pesthuf on Wednesday June 18, 2025 @11:55AM (#44310982)
If it hasn't seen an upstream release since 2019, doesn't that mean the implementation is just... finished? Maybe there's no more bugs to fix and features to add. And in that case, I don't see what's wrong with it.
Re:Bzip2 crate switches from C to 100% rust by LinusU on Wednesday June 18, 2025 @04:15PM (#44312960)
Isn't 10-15% faster compression, and 5-10% faster decompression, a very nice "feature"?

> [...] doesn't that mean the implementation is just... finished?

I don't think that it _necessarily_ means that, e.g. all projects that haven't had a release since 2019 aren't finished? Probably most of them are simply abandoned?

On the other hand, a finished implementation is certainly a _possible_ explanation for why there have been no releases.

In this specific case, there are a handful of open bugs on their issue tracker. So that would indicate that the project isn't finished.

ref: https://sourceware.org/bugzilla/buglist.cgi?product=bzip2

Re:Bzip2 crate switches from C to 100% rust by restalis on Wednesday June 18, 2025 @07:12PM (#44314058)
"Isn't 10-15% faster compression, and 5-10% faster decompression, a very nice «feature»?"

Although much code can be optimized to get it to run 10-15% faster, if that comes at the expense of legibility then such "feature" get rejected nowadays. Translating an existing codebase into a language that makes things more difficult¹ and (because of that) has (and most likely will have) fewer engineers willing to working in it looks very much akin to applying legibility-affecting optimizations to me.

¹ ...and not only. I've already described in other comments some of the issues I see with it as a software development tool, here https://news.ycombinator.com/item?id=31565024 here https://news.ycombinator.com/item?id=33390634 and here https://news.ycombinator.com/item?id=42241516

Re:Bzip2 crate switches from C to 100% rust by LinusU on Thursday June 19, 2025 @05:13AM (#44316827)
> Although much code can be optimized to get it to run 10-15% faster, if that comes at the expense of legibility then such "feature" get rejected nowadays.

Makes sense, and I'd probably make the same call if I was a maintainer and someone submitted a patch which increased performance at the cost of maintainability...

> Translating an existing codebase into a language that makes things more difficult¹ and (because of that) has (and most likely will have) fewer engineers willing to working in it looks very much akin to applying legibility-affecting optimizations to me.

Here I have to personally disagree. I think that Rust is easier than both C and C++. Especially when coming into an already existing project.

The chance of me contributing to a Rust project is higher than to a C project, because I feel more comfortable in knowing that my code is "correct". It's also easier to match the "style" since most Rust projects follow the same structures and patterns, whereas in C it can vary wildly.

E.g. I contributed my first feature to Valkey (Redis fork, C codebase) recently, and figuring out how the tests worked took me quite some time. In fact, in the end I couldn't figure out how to run a specific test so I just ran all tests and grepped the output for my test name. But the tests take tens of minutes to run so this was sub-optimal. On the other hand, 99% of all Rust projects use `cargo test`, and to run a single test I can just click the play button in my editor (Zed) that shows up next to the test (or `cargo test "testname"`).

(with this said, I think that Valkey is a really well structured code base! Great work on their part)

Anyhow, this is just to illustrate my experience. I'm sure that for someone more used to C or C++ they would be more productive in that. And I could go on for ages on all the features that make me miss Rust every day at work when I have to work in other languages, especially algebraic data types!

Re:Bzip2 crate switches from C to 100% rust by moomin on Thursday June 19, 2025 @11:56AM (#44319857)
This is where Rust is going to win out. The significantly larger standard library increases the number of legible improvements one can make.