News for hackers. Stuff that matters.
Re:Alpine Linux Security advisory: OpenSSH-server password a... by adrianN on Thursday November 05, 2026 @01:02PM (#50382202)
I guess this is where the culture around rust shines. You can write crypt that returns a string in rust just fine, just like you can write crypt that returns a tagged union in C. Cultural differences and syntactic sugar change which version is idiomatic.
Re:Alpine Linux Security advisory: OpenSSH-server password a... by mort96 on Thursday November 05, 2026 @01:19PM (#50382432)
The downstream is downstream of the design IMO. In general, people write the API that is obvious. In C, returning a string is obvious, while defining a custom OptionalString type is high friction. In Rust, returning Option<String> is as easy and obvious as returning a String.
Re:Alpine Linux Security advisory: OpenSSH-server password a... by asveikau on Thursday November 05, 2026 @03:41PM (#50384211)
In a C function returning a string, two or three idioms are common for signalling an error.

One is to return NULL for errors.

Another is to make the string result a parameter and use a return code to signal error.

A third, less common but still out there, is an error parameter.

Failure to observe these is on the caller. Forcing the caller to consider the error is probably where rust shines.

But a good C programmer is thinking about these idioms when they encounter a function signature for the first time, or they write one.

Re:Alpine Linux Security advisory: OpenSSH-server password a... by dabinat on Thursday November 05, 2026 @04:05PM (#50384448)
Sure, you could write deliberately bad code in Rust by unwrapping everything everywhere, but the point is that it is a distinct choice to do so. You can’t forget to handle errors - you have to make the choice to disregard them. If you forget to check for NULL in C it won’t complain and it’s dependent upon you to remember to do so.
Re:Alpine Linux Security advisory: OpenSSH-server password a... by mahboi on Thursday November 05, 2026 @06:46PM (#50386228)
Unwrapping everything isn't even bad, that's what most webservers will do
Re:Alpine Linux Security advisory: OpenSSH-server password a... by mahboi on Thursday November 05, 2026 @06:45PM (#50386222)
All the standard Rust libs use results. The standard C and C++ libs use errorno, return 0, return -1, return nullptr, maybe exceptions if C++, ...