Re:Apt Rust requirement raises questions
by dralley on Tuesday November 25, 2025 @10:06AM
(#46046399)
Converting parsers to Rust is not "pointless". Doing string manipulation in C is both an awful experience and also extremely fertile ground for serious issues.
[ Parent
| on HN ]
Re:Apt Rust requirement raises questions
by donkeybeer on Tuesday November 25, 2025 @10:07AM
(#46046407)
apt is C++
It’s very easy to write a string library in C which makes string operations high level (both in API and memory management). Sure, you shouldn’t HAVE to do this. I get it. But anyone writing a parser is definitely skilled enough to maintain a couple hundred lines of code for a linear allocator and a pointer plus length string. And to be frank, doing things like “string operations but cheaply allocated” is something you have to do ANYWAY if you’re writing e.g. a parser.
This holds for many things in C
Re:Apt Rust requirement raises questions
by steveklabnik on Tuesday November 25, 2025 @11:20AM
(#46047339)
This is just a variation of the "skill issue" argument.
If it were correct, we wouldn't see these issues continue to pop up. But we do.
Re:Apt Rust requirement raises questions
by josefx on Tuesday November 25, 2025 @01:34PM
(#46049049)
I think it is more a matter of convenience. There are countless string implementations for C, some tiny projects, others part of larger frameworks like Glib. At the end of the day a C developer has to decide if they are going to pull in half of gnome to handle a few lines of IO or if they are just going to use the functions the C standard conveniently ships with. Most people are going to do the later.
Re:Apt Rust requirement raises questions
by criddell on Tuesday November 25, 2025 @11:18AM
(#46047307)
> a pointer plus length
What would length represent? Bytes? Code points?
Anyway, I think what you are asking for already exists in the excellent ICU library.
And it's not a very easy thing to maintain. Unicode stuff changes more often than you might think and it can be political.
Re:Apt Rust requirement raises questions
by epolanski on Tuesday November 25, 2025 @10:14AM
(#46046484)
Issues that are battle tested from ages.
Re:Apt Rust requirement raises questions
by Cthulhu_ on Tuesday November 25, 2025 @10:27AM
(#46046665)
Sure, which is highly valuable information that hopefully made its way into a testing / verification suite. Which can then be used to rewrite the tool into a memory-safe language, which allows a lot of fixes and edge cases that were added over time to deal with said issues to be refactored out.
Of course there's a risk that new issues are introduced, but again, that depends a lot on the verification suite for the existing tool.
Also, just because someone did a port, doesn't mean it has to be adopted or that it should replace the original. That's open source / the UNIX mentality.