Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1387561 - NT escaping in shebang in easy_install
Summary: NT escaping in shebang in easy_install
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-setuptools
Version: 6.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Python Maintainers
QA Contact: BaseOS QE - Apps
Depends On: 1353934
Blocks: 1367536
TreeView+ depends on / blocked
Reported: 2016-10-21 09:11 UTC by Jan Pokorný [poki]
Modified: 2017-02-15 18:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1353934
Last Closed: 2017-02-15 18:44:21 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Jan Pokorný [poki] 2016-10-21 09:11:50 UTC
Issue also present in RHEL 6.

$ rpm -q python-setuptools
> python-setuptools-0.6.10-3.el6.noarch

+++ This bug was initially created as a clone of Bug #1353934 +++


This prevents equivalent of
> # make Python interpreter executation sane (via -Es flags)
> %{__python2} saveopts -f setup.cfg build_scripts \
>                       "--executable=%{__python2} -Es"

from working properly in RHEL 7, simply because the generated shebang
> #!"/usr/bin/python2 -Es"
which is indeed invalid.

As an aside, I think it would be reasonable to have setuptools
(and friends) patched to the same effect (as opposed to patching
every and each package defining console_scripts in
as a sane (and supportable!) default.

Comment 1 Charalampos Stratakis 2016-10-21 09:38:22 UTC
Is there some simple way to reproduce the issue?

Comment 3 Jan Pokorný [poki] 2016-10-21 13:13:13 UTC
Yes, grab a using (and setuptools-compatible) package that
defines "console_scripts" there (clufter in my case) and run:

# python saveopts -f setup.cfg build_scripts \
                           "--executable=python -Es"
# python build
# python install

Then, observe the scripts from console_scripts definition cannot
be run because of malformed shebang.

Comment 4 Jan Pokorný [poki] 2017-01-23 13:56:47 UTC
(forgot to drop needinfo flag)

Comment 5 Charalampos Stratakis 2017-02-15 18:44:21 UTC
Unfortunately as Michal already pointed out (see bug 1353934) there have been way too many changes upstream when the fix was implemented, so currently a backport of the fix is impossible without refactoring a lot of the relevant setuptools code.

This would be a very invasive change on the way that shebangs are being generated currently, so in this case there is an elevated risk that the current working shebang generation will break (or break other working corner cases), just to fix this specific corner case.

In this particular situation that you reported it would be preferable that the workaround is being used at the individual components, rather than fixing setuptools itself.

Closing it as WONTFIX.

Note You need to log in before you can comment on or make changes to this bug.