Bug 692957

Summary: RPM cannot package python files when there is a docstring on the first line
Product: [Fedora] Fedora Reporter: Rick Smith <magarace>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 13CC: a.badger, dmalcolm, ffesti, jnovy, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-24 14:14:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rick Smith 2011-04-01 19:33:00 UTC
Description of problem:
RPM cannot package python files when there is a docstring on the first line.  The /usr/lib/rpm/find-provides script parses the first line incorrectly and decides the python file is of type '"""'.  This leads to a cryptic and confusing that looks something like this:

line 59: Dependency tokens must begin with alpha-numeric, '_' or '/':

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

rpm-build-4.8.0-1


How reproducible:
Fails every time.


Steps to Reproduce:
1. Find a python file and edit it such that the first line has a docstring (a string in triple quotes).
2. Pack the file into an rpm
3. Observe that it will fail
  
Actual results:

Prints the error below and fails.

Dependency tokens must begin with alpha-numeric, '_' or '/'


Expected results:
The user should be able to build an rpm that contains a python file that starts  with a docstring.


Additional info:
Pylint will complain if a module does not have a docstring so I suspect that it is fairly common to start modules with a docstring.

I've looked at other python scripts that get installed with rpms and found that they had # comments at the top of them with licensing information, which allowed them to be packaged with rpm.

Comment 1 Panu Matilainen 2011-05-24 14:14:10 UTC
This is actually a packaging bug: a file which starts with a docstring should not have executable permissions as such a file cannot be executed. Strip the executable bits off and the issue is gone.

Also if you let rpm use the "internal dependency generator" (which is the default on Fedora) instead of the bit-rotten /usr/lib/rpm/(redhat)/find-provides|find-requires scripts it wont trip up with cryptic errors, but nevertheless the right fix is to remove executable bits on files that cannot be directly.