aws / s2n-quic

An implementation of the IETF QUIC protocol
https://crates.io/crates/s2n-quic
Apache License 2.0
1.13k stars 118 forks source link

Platform detection of sendmsg/sendmmsg does not work as intended #2260

Open jkalez opened 2 months ago

jkalez commented 2 months ago

Problem:

It appears that s2n-quic-platform/build.rs is trying to identify platform support for sendmsg/sendmmsg (and recv variants) at build time. However, the features/socket_mmsg.rs and features/socket_msg.rs are not actually ever compiled by build.rs, so this detection never happens.

One can test this simply by putting junk into any file in s2n-quic-platform/features and the build will still succeed.

Solution:

build.rs should probably attempt to run rustc on files in the features directory instead of just including them in cargo:rerun-if-changed. Alternatively, maybe there's a method to inform cargo via build.rs output that the file needs to be compiled, but rerun-if-changed does not do that.

Requirements / Acceptance Criteria:

cargo rustc -p s2n-quic-platform -- --print cfg will not print out s2n_quic_platform_socket_mmsg on platforms which do not support mmsg, and analogous for platforms which do not support msg. I'm not actually sure these platforms exist or are easy to find, so an alternative acceptance criteria is ensuring that putting a non-compilable file into features.rs does actually fail the build.

WesleyRosenblum commented 1 month ago

Thanks, we'll investigate and see what can be done here.