Bug 1458450 - Fails if shebang has more than one option specified
Summary: Fails if shebang has more than one option specified
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: python3
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Cyprian
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1458449
TreeView+ depends on / blocked
 
Reported: 2017-06-02 23:03 UTC by Björn 'besser82' Esser
Modified: 2018-05-29 11:40 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:40:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Björn 'besser82' Esser 2017-06-02 23:03:11 UTC
Description of problem:

  If a shebang is a Python script has more than one option specified, e.g.
  `#!/usr/bin/python3 -s -tt`, the Python interpreter fails to run the script
  properly and fails with an error message.


Version-Release number of selected component (if applicable):

  3.6.1-6.fc26


How reproducible:

  100%


Steps to Reproduce:

  1. Create an executable Python script with more than one option specified in
     the shebang line, e.g. the given shebang as above.

  2. Execute it.


Actual results:

  Unknown option: - 
  usage: /usr/bin/python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
  Try `python -h' for more information.


Expected results:

  Script runs normally as someone would expect.


Additional information:

  Python2 is also affected by this.  This might affect ealier releases of
  Fedora / RHEL as well.

Comment 2 Björn 'besser82' Esser 2017-06-05 15:54:30 UTC
Please do not close this bug!  The macros provided by the python3-devel package are injecting '/usr/bin/python2 -s' into the shebang of any binary, that gets installed / generated by python-setuptools, causing the shebangs of some scripts hitting the described issue.

Comment 3 Miro Hrončok 2017-06-06 09:46:19 UTC
The bug as you reported = nothing we can do about it.

If you are hitting problems with specific packages and the fact that the macros provided by the python{3,2}-devel package are injecting '/usr/bin/python{3,2} -s' into the shebang, please at least tell us what packages, so we stand a chance to look at it.

Comment 4 Björn 'besser82' Esser 2017-06-06 10:41:02 UTC
Hello Miro,

I hit this recently, when rebuilding the fedora-review package.

Scripts in upstream sources have the shebang set to '/usr/bin/python -tt', setup tools alter them to '/usr/bin/python2 -s -tt', which is pretty invalid…

Comment 5 Tomas Orsava 2017-06-14 14:01:00 UTC
(In reply to Björn "besser82" Esser from comment #4)
> Hello Miro,
> 
> I hit this recently, when rebuilding the fedora-review package.
> 
> Scripts in upstream sources have the shebang set to '/usr/bin/python -tt',
> setup tools alter them to '/usr/bin/python2 -s -tt', which is pretty invalid…

In the specfile you can alter the shebangs of the installed files using sed and consolidate the switches into a single element, e.g. "/usr/bin/python2 -stt", which should be parsed correctly.

Comment 6 Fedora End Of Life 2018-05-03 08:18:19 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2018-05-29 11:40:24 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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