#5326·miri

dirfd support is racy

Author: RalfJungCreated Sep 19, 2026Updated Sep 19, 2026
LabelsC-bugA-shims

We currently support the dirfd operation (getting the directory handle from a DIR stream) by opening both a DIR stream and a directory handle in opendir. If the directory gets replaced or renamed in between those two operations, that will not behave correctly.

Currently this is the best we can do because std does not let us create a ReadDir from a Dir or vice versa. (One of the two directions would suffice.) I hope this will eventually be added as part of https://github.com/rust-lang/rust/issues/120426.