Skip to content

unix: Use metadata for DirEntry::file_type fallback #93471

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jan 30, 2022

When DirEntry::file_type fails to match a known d_type, we should
fall back to DirEntry::metadata instead of a bare lstat, because
this is faster and more reliable on targets with fstatat.

When `DirEntry::file_type` fails to match a known `d_type`, we should
fall back to `DirEntry::metadata` instead of a bare `lstat`, because
this is faster and more reliable on targets with `fstatat`.
@the8472
Copy link
Member

the8472 commented Jan 30, 2022

LGTM. Looking through the tests it seems like we're lacking one that checks that direntry.metadata() gets the symlink metadata, but that's a preexisting issue.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 30, 2022

📌 Commit d70b9c0 has been approved by the8472

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 30, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 30, 2022
…the8472

unix: Use metadata for `DirEntry::file_type` fallback

When `DirEntry::file_type` fails to match a known `d_type`, we should
fall back to `DirEntry::metadata` instead of a bare `lstat`, because
this is faster and more reliable on targets with `fstatat`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 31, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#93395 (Improve suggestion for escaping reserved keywords)
 - rust-lang#93403 (review the total_cmp documentation)
 - rust-lang#93461 (Accommodate yield points in the format_args expansion)
 - rust-lang#93462 (Document `SystemTime` platform precision)
 - rust-lang#93471 (unix: Use metadata for `DirEntry::file_type` fallback)
 - rust-lang#93480 (Remove deprecated and unstable slice_partition_at_index functions)
 - rust-lang#93485 (core: Remove some redundant {}s from the sorting code)
 - rust-lang#93494 (kmc-solid: Inherit the calling task's base priority in `Thread::new`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cd27f1b into rust-lang:master Jan 31, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 31, 2022
@cuviper cuviper deleted the direntry-file_type-stat branch April 12, 2022 17:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants