Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.1: [streamer] Fix musl build (backport of #3836) #4642

Open
wants to merge 1 commit into
base: v2.1
Choose a base branch
from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jan 27, 2025

Problem

msghdr cannot be directly instantiated on musl due to private padding fields (see rust-lang/libc#2344). The recommended solution is to use mem::zeroed to initialize the struct then set the fields as needed.

While we could use the same solution for both glibc and musl, we use a conditional compilation directive to avoid using unsafe code when it's not required.

Summary of Changes

  • Use mem::zeroed to initalize the msghdr struct on musl to avoid issues with private padding fields.

This is an automatic backport of pull request #3836 done by [Mergify](https://mergify.com).

* [streamer] Fix musl build

msghdr cannot be directly instantiated on musl due to private padding
fields (see rust-lang/libc#2344). The recommended solution is to use
`mem::zeroed` to initialize the struct then set the fields as needed.

While we could use the same solution for both glibc and musl, we use a
conditional compilation directive to avoid using unsafe code when it's
not required.

* fix lint warnings

(cherry picked from commit 8c1d4f6)
@mergify mergify bot requested a review from a team as a code owner January 27, 2025 02:04
@milewski
Copy link

Lol I just met this issue, then a PR was created 1min ago that was fast! haha

@steviez
Copy link

steviez commented Jan 27, 2025

The possible justification for BP'ing this to v2.1 (extremely late) is that it fixes a compilation issue for musl targets, see the original PR (#3836) for more details.

@jasl
Copy link

jasl commented Jan 27, 2025

This is very helpful for building program's Rust client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants