Skip to content

Enable statx on supported musl versions#154981

Open
strophy wants to merge 1 commit intorust-lang:mainfrom
strophy:musl-statx
Open

Enable statx on supported musl versions#154981
strophy wants to merge 1 commit intorust-lang:mainfrom
strophy:musl-statx

Conversation

@strophy
Copy link
Copy Markdown

@strophy strophy commented Apr 8, 2026

Rust has feature-gated fs statx calls to gnu libc only. This feature was added to musl libc in the 1.2.5 release, which was in turn included in Rust 1.93.0, see #142682

There is a stale feature gate that is still blocking access to statx calls, even though this is now available in musl libc through the libc crate v0.2.175+, see rust-lang/libc#3976

This PR enables the feature. Note that this will likely cause build breakages anywhere rustix is used, and the issue has already popped up in the rustix repo bytecodealliance/rustix#1496 for archs that never supported musl <1.2.5

This is my first PR here and I need some help coordinating between all these moving parts. @Gankra could you help maybe? Thanks!

More refs:
#67774
vectordotdev/vector#23813
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/98199

r? @Gankra

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 8, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 8, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, jhpratt

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 8, 2026

Failed to set assignee to Gankra: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@rust-log-analyzer

This comment has been minimized.

@strophy strophy changed the title Enable statx on musl versions that support it Enable statx on supported musl versions Apr 8, 2026
Comment thread library/std/build.rs Outdated
Comment thread library/std/src/sys/fs/unix.rs Outdated
@strophy
Copy link
Copy Markdown
Author

strophy commented Apr 10, 2026

Thanks @Darksonn @tgross35 for your review comments. I have simplified the PR to remove the musl version conditions and keep weak linking, it's much simpler now.

Comment thread library/std/src/sys/fs/unix.rs Outdated
Comment thread library/std/src/sys/fs/unix.rs
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 12, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

Copy link
Copy Markdown
Member

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, but I don't have permissions to merge stuff so you will need someone else to take a look.

View changes since this review

Comment on lines -96 to 97
#[cfg(all(target_os = "linux", target_env = "gnu"))]
#[cfg(target_os = "linux")]
use crate::sys::weak::syscall;
Copy link
Copy Markdown
Contributor

@tgross35 tgross35 Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still doesn't seem quite right. Why are we using weak linkage and dynamic detection when we know the version of musl we link?

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some discussion about this pattern here #t-libs > Problems with `syscall!`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants