question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python subprocess invocation to inject setuptools pollutes setuptools argument list

See original GitHub issue

setuptools (and probably distutils) assume the very first argument from sys.argv to be the executed setup file. Invoking a python subprocess with -c to execute a command will set ‘-c’ to be the very first argument to sys.argv (see the docs). This leads to the manifest_maker warning noted at https://github.com/pypa/pip/blob/9b11ed231cc0c7a8101f1ffbdc8b352a12c511b7/pip/req/req_install.py#L868 and also will cause arguments to the setuptools (or distutils) commands to be polluted with an additional ‘-c’, whether it’s wanted or not.

As a workaround, manipulate the argument list prior to exec() in https://github.com/pypa/pip/blob/9b11ed231cc0c7a8101f1ffbdc8b352a12c511b7/pip/req/req_install.py#L843 and similar invocations within pip:

import sys, setuptools, tokenize
sys.argv[0] = %r; ....

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
koobscommented, Jul 8, 2019

Happy 5 year birthday for this issue (last month)! Thank you for resolving this @cjerdonek 😃

FWIW, the review/diff URL mentioned in my earlier comment is now https://reviews.freebsd.org/D270

0reactions
koobscommented, Jul 8, 2019

@cjerdonek I think the best way to answer that question is wherever the issue is found/reproducible, which at the time of the report, was distutils, setuptools, pip.

I looked through @marcusva’s history around the time this issue was created and couldn’t see a referenced setuptools bug report

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python setuptools entrypoints and subapplications as child ...
I have one setupttools distribution that contains a nandful of python packages. This distribution declares some console_scripts entrypoints that ...
Read more >
shiv — shiv documentation
Shiv is a command line utility for building fully self-contained Python zipapps as outlined in PEP 441 but with all their dependencies included!...
Read more >
Changelog — Python 3.11.1 documentation
gh-97612: Fix a shell code injection vulnerability in the get-remote-certificate.py example script. The script no longer uses a shell to run openssl commands....
Read more >
PyInstaller Documentation - Read the Docs
stead invoke the PyInstaller module, by running python -m PyInstaller (pay ... Use the --osx-bundle-identifier argument to add a bundle identifier.
Read more >
PyInvoke
Invoke is a Python (2.7 and 3.4+) library for managing ... Fix a non-fatal bug in our setup.py long_description generation causing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found