-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Handle the case when python is loaded by ld.so #51
Comments
Specifying the entire fully qualified ld.so executable in an env var seems brittle, and having to specify two env var to make everything work doesn't seem nice either. |
These two env vars is not a problem and they can be merged into one with a little parsing code. I agree that this method is brittle, and it may segfault if wrong env vars are passed, so I think this patch is not yet qualified to be merged. Do you have any idea for a more robust solution ? |
A more robust solution would be probably to read /proc/self/cmdline and use it as a reference to walk backwards from environ. |
…obbering This solves numerous issues such as dependence on non-modified environ, existence of Py_GetArgcArgv (and getting argv at all), bug dvarrazzo#51, etc. The only downside(?) is that this might not work on secure Linux - I don't have one ready to check. OTOH this might be an upside...
…obbering This solves numerous issues such as dependence on non-modified environ, existence of Py_GetArgcArgv (and getting argv at all), bug dvarrazzo#51, etc. The only downside(?) is that this might not work on secure Linux - I don't have one ready to check. OTOH this might be an upside...
When python is loaded by
ld.so
, python executable would not be the actualargv[0]
in/proc/self/cmdline
. This can be illustrated as:which outputs
I could not find a portable way to handle this, and currently only come up with a solution of adding two environment vars:
SPT_ARGC_DELTA
andSPT_ARGV0
. In the above example, settingSPT_ARGC_DELTA=1 SPT_ARGV0=/lib64/ld-linux-x86-64.so.2
would produce desired output.The patch is at master...jia-kai:master . If you think it is adequate, I can send a PR.
The text was updated successfully, but these errors were encountered: