-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DirEntry metadata calls in miri #103075
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @RalfJung |
c80ec9b
to
7ec8984
Compare
I can't approve miri-specific library hacks, that needs someone from the libs team. However, from the Miri side, this is lacking tests that ensure that this actually works.
The problem is that dirfd is not exposed by the standard library, so Miri has no good way of implementing that shim in a cross-platform way. |
r? @thomcc |
This would bother me more if we didn't already have both code-paths -- maintaining the It is unfortunate from the perspective of having slightly inaccurate emulation on these targets, though.
Hmm, this is a good point I guess. Would adding a test for this function in libstd be sufficient here? |
Which libstd API function is enabled by this? The test should be added in |
@rustbot author |
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
7ec8984
to
7273358
Compare
The Miri subtree was changed cc @rust-lang/miri |
@rustbot ready |
Thanks. Looks good to me if @RalfJung doesn't want any changes to the tests. |
@bors r=thomcc Looks good to me |
☀️ Test successful - checks-actions |
Finished benchmarking commit (21b2465): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Footnotes |
@@ -404,6 +404,14 @@ fn test_directory() { | |||
let mut file_names = dir_iter.map(|e| e.unwrap().file_name()).collect::<Vec<_>>(); | |||
file_names.sort_unstable(); | |||
assert_eq!(file_names, vec!["test_file_1", "test_file_2"]); | |||
// Test that read_dir metadata calls succeed | |||
assert_eq!( | |||
&[true, true], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we'd also make sure it returns false
on directories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, created #103258
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?
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#L42just noticed that's macos, linux would be using statx: https://github.com/rust-lang/miri/blob/86f0e63b21721fe2c14608644f467b9cb21945eb/src/shims/unix/linux/foreign_items.rs#L112The failing syscall is
dirfd
, so maybe that should actually be added to the shims?