Skip to content

DirEntry::metadata: use dirfd on more targets - #163552

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:dir-entry-metadata
Open

RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:dir-entry-metadata

Conversation

@RalfJung

Copy link
Copy Markdown
Member

Most of the BSDs support dirfd and fstatat just fine but for some reason we've not been using it for DirEntry::metadata. This syncs the cfg for using dirfd with the one that we use in Dir::close for the FD sanity check. Those target evidently all have dirfd as we're using it there, and that's a strict subset of the targets that have Dir handles, so they should support fstatat as well.

try-job: bsd
try-job: various

@rustbot

rustbot commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Any special-casing of Miri in the standard library requires review.

cc @rust-lang/miri

@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 Sep 30, 2026
@rustbot

rustbot commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
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 13 candidates
  • Random selection from ChrisDenton, Darksonn, JohnTitor, Mark-Simulacrum, clarfonthey

@RalfJung

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 30, 2026
DirEntry::metadata: use dirfd everywhere that we support Dir

try-job: *bsd*
try-job: *various*
@RalfJung RalfJung changed the title DirEntry::metadata: use dirfd everywhere that we support Dir DirEntry::metadata: use dirfd on more targets Sep 30, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@RalfJung

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 30, 2026
DirEntry::metadata: use dirfd on more targets

try-job: *bsd*
try-job: *various*
@rust-bors

rust-bors Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 3fd119b (3fd119ba1227cb42fd7d84887708eb2c498e08db)
Base parent: 1625626 (1625626af12c1f95540530c6fc1242ff10aaba0a)

@rust-bors

This comment has been minimized.

@RalfJung
RalfJung force-pushed the dir-entry-metadata branch from a6b3a69 to c97c7de Compare October 2, 2026 20:53
@rustbot

rustbot commented Oct 2, 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.

@RalfJung
RalfJung force-pushed the dir-entry-metadata branch from c97c7de to 6a7b5dd Compare October 2, 2026 20:55
target_os = "nto",
target_os = "qnx",
target_os = "vita",
target_os = "hurd",

@RalfJung RalfJung Oct 2, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hurd has dirfd according to libc, and we've been using it for DirEntry::metadata, so it should be fine to use here as well.

View changes since the review

Comment thread library/std/src/sys/fs/unix.rs Outdated
@RalfJung
RalfJung force-pushed the dir-entry-metadata branch from 6a7b5dd to 3b1fc44 Compare October 3, 2026 10:43
@RalfJung
RalfJung force-pushed the dir-entry-metadata branch from 3b1fc44 to 46b2135 Compare October 3, 2026 18:36

This branch has not been deployed

No deployments
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.

4 participants