logoalt Hacker News

realharo • today at 5:16 PM • 2 replies • view on HN

>because crypt in musl started returning "*" in some cases some years ago

In Rust, the type of the return value would be a `Result<T, E>`, which means the chain of events that led to this would never have started in the first place.


Replies

my-huge-pony • today at 5:18 PM

In C the return value would be NULL, except it was changed by musl at some point.

Edit: at the beginning, crypt always returned a value. So hypothetical Rust return type would be a String, and then it would be retained for backward compatibility. Or something else would happen, this is a complex logic bug triggered by a 25 year old chain of events.

➕ show 1 reply
atomicUpdate • today at 7:04 PM

You mean could be a `Result<T, E>`. There’s nothing in Rust that forces that.