-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix #15149 test, and allow it to run with noexec /tmp on POSIX systems. #21498
Conversation
…e child panics before passing.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
@bors: r+ 06d4 |
⌛ Testing commit 06d4019 with merge ee7b199... |
💔 Test failed - auto-win-64-nopt-t |
Trying again. I think the problem was another bug in the original, an inconsistent use of EXE_SUFFIX. If the test fails again, I added more debugging output to the log, so that it should be more obvious why it failed. |
let my_path = os::self_exe_name().unwrap(); | ||
let my_dir = my_path.dir_path(); | ||
|
||
let child_dir = Path::new(my_dir.join("issue-15149-child")); |
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.
Could this add some random substring to the end of the directory as well? It's possible that this test is run a few times in parallel and it would help prevent conflicts
… directory's name, and remove the directory after a successful test.
I added some simple randomness to the directory name, and the test removes the directory when the test passes (to avoid accumulating a bunch of different directories when the test is run multiple times). The directory is not removed on failure, but I think that that might actually be helpful if the test fails. (Plus, I was feeling too lazy to implement a new RAII type to remove the directory on panic.) Note that |
Ah the other test is fine for now, thanks for doing this! |
While trying to experiment with changes for some other issues, I noticed that the test for rust-lang#15149 was failing because I have `/tmp` mounted as `noexec` on my Linux box, and that test tries to run out of a temporary directory. This may not be the most common case, but it's not rare by any means, because executing from a world-writable directory is a security problem. (For this reason, some kernel options/mods such as grsecurity also can prevent this on Linux.) I instead copy the executable to a directory created in the build tree, following the example of the `process-spawn-with-unicode-params` test. After I made that change, I noticed that I'd made a mistake, but the test was still passing, because the "parent" process was not actually checking the status of the "child" process, meaning that the assertion in the child could never cause the overall test to fail. (I don't know if this has always been the case, or if it has something to do with either Windows or a change in the semantics of `spawn`.) So I fixed the test so that it would fail correctly, then fixed my original mistake so that it would pass again. The one big problem with this is that I haven't set up any machines of my own so that I can build on Windows, which is the platform this test was targeted at in the first place! That might take a while to address on my end. So I need someone else to check this on Windows.
While trying to experiment with changes for some other issues, I noticed that the test for rust-lang#15149 was failing because I have `/tmp` mounted as `noexec` on my Linux box, and that test tries to run out of a temporary directory. This may not be the most common case, but it's not rare by any means, because executing from a world-writable directory is a security problem. (For this reason, some kernel options/mods such as grsecurity also can prevent this on Linux.) I instead copy the executable to a directory created in the build tree, following the example of the `process-spawn-with-unicode-params` test. After I made that change, I noticed that I'd made a mistake, but the test was still passing, because the "parent" process was not actually checking the status of the "child" process, meaning that the assertion in the child could never cause the overall test to fail. (I don't know if this has always been the case, or if it has something to do with either Windows or a change in the semantics of `spawn`.) So I fixed the test so that it would fail correctly, then fixed my original mistake so that it would pass again. The one big problem with this is that I haven't set up any machines of my own so that I can build on Windows, which is the platform this test was targeted at in the first place! That might take a while to address on my end. So I need someone else to check this on Windows.
This caused a test failure in the rollup.
|
More strangely. on my local test, it seems that Even more strangely, after the successful execution, my assertion error differs from the one from the buildbot.
Note that the left arm does not have the My system is Windows 8.1, so maybe this is the reason? It seems that the filename check is not reliable on Windows, and I even believe the logic can be removed entirely. |
@barosl: I believe that I can mostly explain this now. Looking more closely at If the program is not found in the child's path (either because an absolute path was used, or because it's just not there), we call The one thing that I don't get is why in your local path, the program is not being found in the child's path. This shouldn't vary by Windows version because |
While the above output was resulted from the direct compilation of the test code, I've just set up my Windows compilation environment for the first time, and run Oddly, the check process failed earlier because of the
But even after removing the space from
So I believe my system is fundamentally flawed. I still consider this a bug of the build infrastructure, but it may not be related to this PR. So it would be OK to ignore my case for now. |
While trying to experiment with changes for some other issues, I noticed that the test for #15149 was failing because I have
/tmp
mounted asnoexec
on my Linux box, and that test tries to run out of a temporary directory. This may not be the most common case, but it's not rare by any means, because executing from a world-writable directory is a security problem. (For this reason, some kernel options/mods such as grsecurity also can prevent this on Linux.) I instead copy the executable to a directory created in the build tree, following the example of theprocess-spawn-with-unicode-params
test.After I made that change, I noticed that I'd made a mistake, but the test was still passing, because the "parent" process was not actually checking the status of the "child" process, meaning that the assertion in the child could never cause the overall test to fail. (I don't know if this has always been the case, or if it has something to do with either Windows or a change in the semantics of
spawn
.) So I fixed the test so that it would fail correctly, then fixed my original mistake so that it would pass again.The one big problem with this is that I haven't set up any machines of my own so that I can build on Windows, which is the platform this test was targeted at in the first place! That might take a while to address on my end. So I need someone else to check this on Windows.