breard-r / acmed

ACME (RFC 8555) client daemon
MIT License
171 stars 25 forks source link

Runtime failure on 32-bit platforms on musl 1.2.0+ #59

Closed ptrcnull closed 2 years ago

ptrcnull commented 2 years ago

Looks like fix introduced in https://github.com/breard-r/acmed/commit/220f580d90b31cd4c4dd7efe965da51d67e110ac now emits a warning, due to https://github.com/rust-lang/libc/issues/1848 and the test added along with the fix fails on Alpine Linux edge:

---- tests::certificate::cert_expiration_date_past stdout ----
thread 'tests::certificate::cert_expiration_date_past' panicked at 'called `Result::unwrap()` on an `Err` value: Error { message: "error:0D0D90AD:asn1 encoding routines:ASN1_TIME_adj:error getting time:crypto/asn1/a_time.c:330:" }', acme_common/src/tests/certificate.rs:179:37
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
nekopsykose commented 2 years ago

imo this is really a rust-libc issue, since they still define libc::time_t as c_long irrespective of what the platform is saying (so on musl, this is wrong for 32-bit, as the issue says). as such, it doesn't make too much sense to fix here, and they should just merge the actual fixes already...

breard-r commented 2 years ago

Thank you for this report!

The real issue here may not be the libc one, but the fact that I used it only to create an openssl::asn1::Asn1Time struct with the current time. After reading the OpenSSL documentation with more attention than before, I managed to do it with days_from_now(0) instead.

With the libc::time_t gone, this issue should be fixed. However, because I haven't tested it on a 32-bit platform with musl, I'm not closing it without additional feedback.

ptrcnull commented 2 years ago

It seems to compile and pass all tests on 32-bit architectures, thanks :)

Would you mind making a new tagged release with this and the other improvements?

breard-r commented 2 years ago

Than you for the feedback! 🙂 Since this issue is resolved, I'm closing it and I'll make a new release in the next minutes.