linkedin / linkedin/shiv

shiv generates invalid shebang line in git bash (windows/mingw)

Open
#168 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
114
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm having a strange issue where the interpreter that ends up in the shiv zipapp is different from what I give it with the `-p` option. I can't figure out where this translation is happening. I do this on Windows with "git bash", which is a mingw environment that ships with the standard git installer. Here are my steps, after setting up a venv and installing shiv:
```
/c/source/shiv$./env/Scripts/python --version
Python 3.6.8

/c/source/shiv$./env/Scripts/shiv --version
shiv, version 0.4.0

/c/source/shiv$uname -a
MINGW64_NT-10.0-14393 DEVHOST31 3.1.4-340.x86_64 2020-05-19 12:55 UTC x86_64 Msys

/c/source/shiv$./env/Scripts/shiv -e script:main -p '/usr/bin/env python' -r /dev/null -o out.pyz

/c/source/shiv$head -1 out.pyz
#!C:/Program Files/Git/usr/bin/env python

/c/source/shiv$./out.pyz
bash: ./out.pyz: C:/Program: bad interpreter: No such file or directory
```
Something is prefixing "C:/Program Files/Git/" to my provided interpreter, causing it to become invalid. Any help would be much appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no source file or test. Reproduce the command in Git Bash on Windows, then trace shebang generation for the -p option and the Windows/Mingw path translation. Done means the generated first line preserves the requested interpreter and the resulting zipapp runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.