I was very confused by this sentence until I realized it's a programming thingy.
post
I'm not a rust programmer, can anyone with experience in systems programming explain a legitimate use case for the uutils other than weakening the GPL? The auther even admits that several coreutils are still GNU in 26.04 which begs one to ask "why the rewrite?"
The goal is to create a more secure version of the program. Since (safe) rust eliminates entire classes of security relevant bugs, a rust version has the potential to be much more secure that the C version. And since rust can eliminate entire classes of bugs, we can put more energy into finding bugs like the ones presented in the article.
The weaker license is unfortunate, though.
Wait, what? How? It compiles down to bare metal without a runtime. People write OSes and program microcontrollers with it. For any arbitrary C program, it's possible to write Rust code such that it compiles down to the same bytecode. Am I missing something?
Guess i've a different understanding of systems language.
Wait, I'm so confused, what's your definition of a systems language?
One you use to manipulate the system / solve problem efficiently, vs. creating GUIs. Which has heavy repercussions on what types of developers use it, how the ecosystem and language is built. One metric to distinguish them is new features / year; admin + hacker types want a stable & clever interface, companies and UI devs new features. And yeah, Rust is a bit of both of them, but has all the characteristics of the later.
I have the feeling, you soon need a meta-language or extensive IDE-help to even use it. Just like C++.
edit: In hindsight, this sounds more silly than i thought. There was a great article about it i can't find anymore, with the conclusion, that Rust is no systems language by that metric.
This is an excellent article that breaks down common pitfalls and provides really concise rules for avoiding them. It's a great read if you're in to systems programming.
As someone who is not at all into programming, this title made me genuinely think I had a stroke.
Those are bugs I dont think any programming language catch, unless it's a DSL for writing such programs on Linux or another OS.
It could be improved. Sebastian Wick and Lennart Poettering made comments on how hard POSIX makes it hard to be secure. There are better APIs that try to be safer.
- https://blog.sebastianwick.net/posts/how-hard-is-it-to-open-a-file/
- https://mastodon.social/@pid_eins/116459585811044061
And since uutils is not Linux only, it can't use these safer APIs directly, or at least not without writing more platform-specific code.
Some of them seem to be harder to fix or to get right in Rust than C though. Mostly due to "convenience" methods that make application writing easier.
Another stupendous reason to gpl uutils so that the decades of experence of hundreds of system programmers can be leveraged in the rewrite.
I didn't realize this was posted here.
Allow me to copy my comment from another thread:
// Don't bail on the first error, but remember the worst one.
let mut worst = 0;
for file in files {
if let Err(e) = chmod_one(file) {
worst = worst.max(e.exit_code());
}
}
process::exit(worst);
This is not rustic, I feel.
files.iter()
.map(chmod_one)
.filter_map(Result::err)
is more like it.
From there, you can next() for first error, last() for last error, or fold() for max error, or collect() if you need to save all errors.
And no, static compilation doesn’t help here, because
get_user_by_namegoes through NSS, which dlopenslibnss_*modules at runtime regardless of whether your binary is statically linked.
This is not true in musl systems. I just quickly checked in a Chimera rootfs (which has a system dynamic musl libc btw).
I believe the described dlopening is one of the well known reasons why GNU libc is not suitable for static linking, unlike musl!
In Arch, this indeed loads /usr/lib/libnss_systemd.so.2.
Everyone can test this with strace id 2>&1 | egrep 'open.*\.so'.
In that for, all error messages have been lost. If to add such output “for” is the most elegant solution.
No they're in the resulting iterator
all 12 comments