-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
Overwriting sys.argv[0] leaves no remaining methods to identify the actual sys.argv[0] #2006
Comments
There is probably not. Let me dig up why that changed. My policy is to not break folks until the 3.x transition so this is a bug unless the change was intentional and fixed something else and that something else trumps this after debate. You'll make my day if this broke your conscript BusyBox. |
Yeah. so #1785 was 1st released in 2.1.91; so that's likely the root cause of the regression. I'll see what I can do today and get out a ... pretty luke warm hotfix at this point if possible. |
Well, that was too easy. Removing the |
@jamesmeador it would be great if you can chime in on #2007. Namely what is your use case and does this fix it? I assume a conscript / BusyBox use case and I fix that, but it would be helpful to know exactly what you were previously doing successfully with PEX using |
@jamesmeador I'm going ahead with this fix since it definitely fixes the broken BusyBox case. If this doesn't solve your git hook case - please report back with details. |
Alright @jamesmeador a fresh cut with this fix is out in 2.1.118: https://pypi.org/project/pex/2.1.118/. |
@jsirois if only I had been able to test this sufficiently for you... maybe the issue is still on my end. I'm still seeing this, and I made a test pex to illuminate the issue:
Executing the pex:
In theory, this should have output Here's some more info that may shed light on something else that could be going wrong?
|
@jamesmeador I'm AFK, but can you try a function entry point instead and see what happens? |
That works! Thanks for the reply while AFK. |
Ok. I'll take a look at your case, which is the |
Yeah, so its either make -m work to preserve symlinks in sys.argv[0] or make -m work with pickle: #1018 @jamesmeador as far as I can tell there is simply no way to make -m satisfy both pickle and the preservation of symlinks case. Are you OK with the function entrypoint workaround? |
As of the 2.1.91 release, sys.argv[0] is no longer a reliable option for identifying the executed script as called.
For example, creating a symlink to a pex, then calling that symlink yields a sys.argv[0] that does not point to the symlink. The PEX environment variable also does not point to the symlink.
Are there any known remaining ways to obtain argv[0] as provided by the calling binary?
The text was updated successfully, but these errors were encountered: