Skip to content

Commit 85bc402

Browse files
committed
Auto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc
Support DirEntry metadata calls in miri This should work as it uses lstat64 which is supported here: ~https://github.com/rust-lang/miri/blob/d9ad25ee4bbd9364c498959cdc82b5fa6c41e63c/src/shims/unix/macos/foreign_items.rs#L42~ just noticed that's macos, linux would be using statx: https://github.com/rust-lang/miri/blob/86f0e63b21721fe2c14608644f467b9cb21945eb/src/shims/unix/linux/foreign_items.rs#L112 The failing syscall is `dirfd`, so maybe that should actually be added to the shims?
2 parents 84b6896 + 9b690cf commit 85bc402

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

std/src/sys/unix/fs.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,10 @@ impl DirEntry {
674674
self.file_name_os_str().to_os_string()
675675
}
676676

677-
#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
677+
#[cfg(all(
678+
any(target_os = "linux", target_os = "emscripten", target_os = "android"),
679+
not(miri)
680+
))]
678681
pub fn metadata(&self) -> io::Result<FileAttr> {
679682
let fd = cvt(unsafe { dirfd(self.dir.dirp.0) })?;
680683
let name = self.name_cstr().as_ptr();
@@ -695,7 +698,10 @@ impl DirEntry {
695698
Ok(FileAttr::from_stat64(stat))
696699
}
697700

698-
#[cfg(not(any(target_os = "linux", target_os = "emscripten", target_os = "android")))]
701+
#[cfg(any(
702+
not(any(target_os = "linux", target_os = "emscripten", target_os = "android")),
703+
miri
704+
))]
699705
pub fn metadata(&self) -> io::Result<FileAttr> {
700706
lstat(&self.path())
701707
}

0 commit comments

Comments
 (0)