-
Notifications
You must be signed in to change notification settings - Fork 385
Use real exec on cfg(unix) targets #2426
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
Conversation
Hunh, didn't know about the tests for cargo-miri. Definitely not the right behavior here... |
Well I now know how to use |
Ahhhh that's why the standard library doesn't just pipe2 for all cfg(unix). I'll switch it to just |
Yeah, I came to about the same conclusion. OTOH finding a location for a temporary file could also be annoying. And who's going to clean up that file? |
74d719c
to
9525719
Compare
@rustbot ready |
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.
Generally looks good. :)
(We really should split this into multiple files... another time.)
@rustbot author |
By the way, I've now read every piece of documentation on pipes that I could find and oh boy there is not very much. I was reminded that pipes have a finite capacity which is not particularly huge. MacOS is probably 16 kB by default? Linux is probably 64 kB by default? I'm just extra wary of these limits now, because the "actually exec" implementation doesn't have the child process running so if the file contents don't fit in the pipe... 🤷 we just panic from an My Macbook reports that its pipe size is 512 bytes via |
Yeah I was wondering about pipe size issues... maybe the more robust solution is to store the input in a separate file next to the JSON, and then pass that file as stdin? Though that does make me wonder about who's going to clean up those files. (Well I already wonder that with the new |
Hunh. The |
On Unix you can open a file and delete it and it'll get actually deleted when it gets closed... but I am not sure if that is possible on Windows. |
Good thing we don't need that sort of pattern on Windows then? |
Oh yeah I guess for now we're only trying to real-exec on Unix, fair. |
f1a0615
to
c92423b
Compare
@rustbot ready |
Just one more comment, then please squash it all and we're good to go. :) |
When cargo-miri is executed as a cargo test runner or rustdoc runtool, external tools expect what they launch as the runner/runtool to be the process actually running the test. But in the implementation, we launch the Miri interpreter as a subprocess using std::process::Command. This tends to confuse other tools (like nextest) and users (like the author). What we really want is to call POSIX exec so that the cargo-miri process becomes the interpreter. So this implements just that; we call execve via a cfg(unix) extension trait. Windows has no such mechanism, but it also doesn't have POSIX signals, which is the primary tripping hazard this change fixes.
@bors r+ |
☀️ Test successful - checks-actions |
Closes #2421
The standard library has a platform extension trait that lets us get the behavior we want on cfg(unix), so why not use it?
I tried this out and it produces the correct behavior in concert with nextest.