shiv icon indicating copy to clipboard operation
shiv copied to clipboard

Incorrect bootstrap filename

Open cjntaylor opened this issue 1 year ago • 1 comments

When run from within a zip file (such as by directly importing the shiv wheel or within a traditional zipapp), the bootstrap files are stored with temporary file names (From src/shiv/builder.py#L160-L167):

write_to_zipapp(
    archive,
    str(bootstrap_target / path.name),
    data,
    zipinfo_datetime,
    compression,
    stat=path.stat(),
)

str(bootstrap_target / path.name) won't work when embedded - path points to a temporarily extracted temporary file, producing archive names like this:

1980-01-01 06:00:00 .....         8977         3275  _bootstrap/tmp3dxelv3u__init__.py
1980-01-01 06:00:00 .....         2878          945  _bootstrap/tmpxt4291z2environment.py
1980-01-01 06:00:00 .....         2063          716  _bootstrap/tmp1lkt9o0xfilelock.py
1980-01-01 06:00:00 .....         1762          725  _bootstrap/tmprndqhn00interpreter.py

Is there some reason this isn't just str(bootstrap_target / bootstrap_file)? Making this simple change seems to work correctly in all cases I can test. PR incoming.

cjntaylor avatar Dec 23 '23 09:12 cjntaylor

I'm normally not one to do this, but, just a quick *bump* as I've made an alteration to the PR to adjust to the most recent release, along with an explanation as to why I think this is important.

I'd be happy with a wontfix and this issue being closed. At least then I'm not in limbo of knowing if I need to maintain my own fork indefinitely or not.

cjntaylor avatar Feb 22 '24 07:02 cjntaylor

I'm normally not one to do this, but, just a quick bump as I've made an alteration to the PR to adjust to the most recent release, along with an explanation as to why I think this is important.

I'd be happy with a wontfix and this issue being closed. At least then I'm not in limbo of knowing if I need to maintain my own fork indefinitely or not.

So sorry for my absence on this issue & the associated PR! Ever since we started using Github internally I feel like I've not been keeping up with projects associated with my personal user, not an excuse though. I appreciate your patience!

lorencarvalho avatar May 09 '24 21:05 lorencarvalho

No worries! I know that everyone is busy and it takes time to sort these things out. I appreciate the merge; I want to promote shiv's usage but that's a bit of a hard sell when I have to reference my git module as a dependency, so I'm glad that's settled.

Thanks for your hard work!

cjntaylor avatar May 10 '24 02:05 cjntaylor