Incorrect value for sys.argv[0] when built with shiv>=0.5.0
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
Minimal reproduction: https://github.com/Thirdegree/shiv-issue-reproduction
Output when built with shiv<0.5.0 (expected output):
$ pip install 'shiv<0.5.0'
[...]
$ shiv -c example . -o my-other-example
[...]
$ ./my-other-example
['./my-other-example']
and shiv>=0.5.0:
$ pip install 'shiv>=0.5.0'
[...]
$ shiv -c example . -o my-other-example
[...]
$ ./my-other-example
['/home/<snip>/.shiv/my-other-example_4e97fbfbe05adc1827d2cf3da93d0600d4eb83fdb7b83d1230c1127d42c9e4e0/site-packages/bin/example']
This seems to only be an issue when built with -c:
$ shiv -e reproduce.main:main -o my-example .
$ ./my-example
['./my-example']
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked minimal reproduction with shiv versions before and after 0.5.0, comparing builds made with -c against those using -e. Trace the command-entry behavior involved in setting sys.argv[0]. Done means the -c-built executable reports its own invocation path, matching the expected output shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100