-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Produce sane CARGO when invoked through ld.so #10115
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
Conversation
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
58b55a2
to
0fa5b14
Compare
From the description of #10113 I didn't quite understand why executables were being invoked in this fashion, I actually had no idea this was even possible. To some extent this feels like an issue for the standard library rather than Cargo itself because this presumably plauges all users of |
Er, sorry, meant to include the question, can you detail a bit more why Cargo is being invoked in this fashion? |
Ah, so, invoking through ld.so is basically a slightly saner way to manage the shared library search path than setting If the question is "why do you need to set the shared library search path?", the answer is that this is necessary when libraries are not necessarily located in the standard system locations, in my case because ever executable gets its own execution environment that contains the exact version of the shared libraries it was built with. As for the question of whether this should just be fixed in |
Hm ok that makes sense. I'll let @ehuss decide on whether to sign-off on this or not. Personally this feels so esoteric I would prefer to not have it in Cargo itself. It feels to me like this technique of spawning a process through |
Yeah, it's a tricky one. I'm also torn on where the fix should ultimately live. My thinking is that it's Cargo's responsibility to set |
I personally agree with @alexcrichton that this seems too specific to go in Cargo as-is. We often get cases where Cargo is asked to work around and fix an issue that applies to almost any other program, and we're typically hesitant to pioneer a solution that isn't pushed in some more common shared place, especially if it isn't clear what the consensus solution should be. If there were a common library crate that provided a function handling this situation and providing a well-defined result, and some indication that others were willing to use that too, we might be willing to consider using that. |
In my particular case, the proposal in #10119 (comment) ("propagate |
I'm going to close this as I agree with the comments above that this is probably not something we would want to add. As for reading the |
If
current_exe
indicates that the current exe isld-*.so.*
(so it "looks like" the dynamic linker), we fall back to usingargv[0]
instead.Fixes #10113, which also has further details on the problem.