Skip to content

Add additional fields to statx#4621

Open
Thomasdezeeuw wants to merge 7 commits into
rust-lang:mainfrom
Thomasdezeeuw:statx-fields
Open

Add additional fields to statx#4621
Thomasdezeeuw wants to merge 7 commits into
rust-lang:mainfrom
Thomasdezeeuw:statx-fields

Conversation

@Thomasdezeeuw

@Thomasdezeeuw Thomasdezeeuw commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

Description

Updates statx to include all fields as of Linux v6.16.

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added O-linux-like O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Aug 7, 2025
@Thomasdezeeuw

Copy link
Copy Markdown
Contributor Author

The CI failure is a Clippy complaints about code I didn't change:

error: this `if` statement can be collapsed
   --> ctest-next/src/translator.rs:221:9
    |
221 | /         if let syn::PathArguments::AngleBracketed(args) = &last.arguments {
222 | |             if let syn::GenericArgument::Type(inner_ty) = args.args.first().unwrap() {
223 | |                 // Option<T> is ONLY ffi-safe if it contains a function pointer, or a reference.
224 | |                 match inner_ty {
...   |
237 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
    = note: `-D clippy::collapsible-if` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]`
help: collapse nested if block
    |
221 ~         if let syn::PathArguments::AngleBracketed(args) = &last.arguments
222 ~             && let syn::GenericArgument::Type(inner_ty) = args.args.first().unwrap() {
223 |                 // Option<T> is ONLY ffi-safe if it contains a function pointer, or a reference.
...
235 |                 }
236 ~             }
    |

error: could not compile `ctest-next` (lib) due to 1 previous error

If the maintainers want I can send a pr for this, but I don't think it should be done in this pr.

@tgross35

Copy link
Copy Markdown
Contributor

These haven't yet been updated in glibc https://github.com/bminor/glibc/blob/a6eb8285d9bfb7ec0875b85ca356e833ff964d4f/io/bits/types/struct_statx.h#L30 or musl, so we should wait for that.

@rustbot blocked

The CI failure is a Clippy complaints about code I didn't change:

That has been fixed, should go away with a rebase

@tgross35

Copy link
Copy Markdown
Contributor

For reference, here's the glibc patchset adding this https://inbox.sourceware.org/libc-alpha/20251003194707.2326679-1-adhemerval.zanella@linaro.org/

@Thomasdezeeuw

Copy link
Copy Markdown
Contributor Author

@tgross35 it seems like the patchset was merged: https://github.com/bminor/glibc/blob/bd569425330c6f5644c232b4b253e9ab905fcdba/io/bits/types/struct_statx.h#L56-L62. Are there any requirements in terms of release/deployment of the glibc changes (i.e. a minimum version)? Or should I rebase and it's good to merge?

@tgross35 tgross35 left a comment

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.

@tgross35 it seems like the patchset was merged: https://github.com/bminor/glibc/blob/bd569425330c6f5644c232b4b253e9ab905fcdba/io/bits/types/struct_statx.h#L56-L62. Are there any requirements in terms of release/deployment of the glibc changes (i.e. a minimum version)? Or should I rebase and it's good to merge?

Thanks for the update, nope that's about it. I'll merge after rebase and CI passing 👍

(Note you may need to skip these fields in libc-test/build.rs)

Comment thread src/unix/linux_like/mod.rs Outdated
@rustbot

This comment has been minimized.

@Thomasdezeeuw

Thomasdezeeuw commented Dec 28, 2025

Copy link
Copy Markdown
Contributor Author

Rebased and added the padding.

@rustbot

This comment has been minimized.

@tgross35

Copy link
Copy Markdown
Contributor

Looks like that version should be in the next Ubuntu update, in October. If you'd prefer not to wait for then, it could work to add test skips to the relevant fields in libc-test/build.rs.

@tgross35

Copy link
Copy Markdown
Contributor

Once #5188 you'll be able to gate on kernel and/or glibc version, which should make this more sane.

@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

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.

@Thomasdezeeuw

Copy link
Copy Markdown
Contributor Author

I rebased this on main/#5188, needed to do a force push. The existing commits are not changed, only change is in the new commit.

Comment thread src/unix/linux_like/mod.rs Outdated
Comment on lines +295 to +296
// The following fields are not available on Android as of
// August 6th 2025.

@tgross35 tgross35 Jun 30, 2026

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.

If this is still relevant, mind updating to 2026-06?

View changes since the review

Comment thread libc-test/build.rs
}
});

cfg.skip_struct_field_type(move |union_, field| {

@tgross35 tgross35 Jun 30, 2026

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.

These skips should be in skip_struct_field to not run any tests on them, rather than skip_struct_field_types which just turns off some of the checks for that field.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Thomasdezeeuw

Copy link
Copy Markdown
Contributor Author

Alright, took some time but this is finally green @tgross35 :)

@tgross35 tgross35 left a comment

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.

LGTM! Please just squash

View changes since this review

@tgross35

Copy link
Copy Markdown
Contributor

@rustbot author

@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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

Labels

O-linux-like O-unix S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants