-
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
Error early if there are spaces in the source directory path, rather than waiting for LLVM to fail #101043
Conversation
The build system fails if there are spaces in the path leading to the rust repository. This is a quick fix that detects if there are any spaces in the path leading to the rust repository, and if there are, quits with a message warning the user about the problem. Signed-off-by: Cem Karan <[email protected]>
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
I feel like globally preventing this in x.py isn't the right way to go; at minimum it should live inside rustbuild itself. Emitting the hard error as part of the |
@Mark-Simulacrum I don't know enough about the compiler to really do much more than I have with this PR. If you can point me at the right files to modify, I can take a stab at it, but unfortunately, given my current knowledge level of the internals of the compiler, this is about the best I can do. The one real advantage to putting it in |
I would expect us to put the check around here. This is all build system modification, not the compiler itself. |
I poked around that code a little bit; are you sure that's the best place to put this check? The only thing that I see here to check over is
which I interpret as meaning that if we don't modify the environment variable, then it will be passed without change to the child process. Moreover, are we guaranteed that all uses of the path to the current working directory funnel through this chunk of code? I know that everything is funneling through |
Right, that's the point - not all invocations of x.py with spaces fail currently, so we shouldn't fail more often after this PR than we did before.
That's changing soon. |
Checking the working directory https://doc.rust-lang.org/nightly/std/env/fn.current_dir.html I think would suffice there. |
Oooooffff... OK, that's sufficiently bad that the current PR will be useless very quickly. I'm going to close this PR, and if I have more time in the future, I'll dig into where @Mark-Simulacrum suggested within the build system. Unless that's going away soon too? |
Will this work if someone starts the build from a different directory? E.g., someone is in the parent directory and wants to start the build with |
We do support building outside of the source directory, yes. Not sure why Mark suggested using the working directory - the thing that makes this go wrong is when llvm-config prints paths with spaces, and the paths it prints are only affected by the build directory and not the source directory. I guess that's an argument to use |
95% of users (or more) are going to build in the working directory; using the build directory would probably be better though. In general I think the point here is that we're just adding a heuristic-based error more than trying to eliminate some bug directly, so if we don't catch all cases that seems ok. |
Yeah, I think that what @Mark-Simulacrum said is probably the right way of thinking about this issue. Not a 100% solution, just a quick fix that deals with a large chunk of the user base's problems. Honestly, unless everyone is willing to invest the time in completely overhauling the build system all the way down through LLVM, I don't think we can do any better than a bunch of heuristics. And just to be clear, I for one do not want to open the can of worms of trying to rewrite the entire build system from scratch. It is absolutely not worth the time or trouble to do so! |
euclio had a patch with a proper fix to LLVM: #56650 (comment) it would be nice to rebase that and get it merged at least to https://github.com/rust-lang/llvm-project, even if it's not upstreamed. |
Looks like euclio had a lot of changes that would need to be freshened up. I don't have time to look into it at the moment, unfortunately, so unless someone else is willing to take it on it's probably not going to get fixed. |
The build system fails if there are spaces in the path leading to the rust repository. This is a quick fix that detects if there are any spaces in the path leading to the rust repository, and if there are, quits with a message warning the user about the problem.
cc #56650
Signed-off-by: Cem Karan [email protected]
r?