Bug 1271636 - RFE: add detection of Python bytecode for recent versions of Python
RFE: add detection of Python bytecode for recent versions of Python
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: file (Show other bugs)
7.2
All Linux
low Severity medium
: rc
: ---
Assigned To: Kamil Dudka
Eva Mrakova
: FutureFeature, Regression
Depends On:
Blocks: 1313485 1289025 1295829
  Show dependency treegraph
 
Reported: 2015-10-14 08:22 EDT by Eva Mrakova
Modified: 2016-11-04 03:36 EDT (History)
7 users (show)

See Also:
Fixed In Version: file-5.11-32.el7
Doc Type: Enhancement
Doc Text:
Feature: The file utility now recognizes Python byte code also for Python versions 3.3, 3.4, and 3.5. Reason: These Python versions are now frequently used. Result: Python byte code of the mentioned versions is now recognized properly.
Story Points: ---
Clone Of: 809898
Environment:
Last Closed: 2016-11-04 03:36:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eva Mrakova 2015-10-14 08:22:04 EDT
Also happens for
file-5.11-31.el7.x86_64
(versions of Python >3.2)

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

Can we ensure that "file" in RHEL6 identifies Python bytecode for all released versions of Python?
(i.e. 2.7, 3.0, 3.1, 3.2, and, later this year, 3.3)

I'm not sure if the Fedora work below made it into RHEL6:

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

Created attachment 366152 [details]
Add bytecode values for Python 3.0 and 3.1

Description of problem:
Attached is a patch that adds support for Python 3.0 and Python 3.1 bytecode files to the .pyc/.pyo support.

With this file:
$ file /usr/lib/python3.1/re.pyo
/usr/lib/python3.1/re.pyo: python 3.1 byte-compiled

Caveat: only tested with 3.1; I calculated up the value for 3.0 from the source in python's py3k branch's Python/import.c:
[snip]
       Python 3.0a5: 3130 (lexical exception stacking, including POP_EXCEPT)
[snip]
       Python 3.1a0: 3150 (optimize conditional branches:
			   introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
[snip]

Note that the value has 1 added to it in py3k's _PyImport_Init,
giving:
  python 3.0: magic=3131 = 0x0c3b (hex) =  0x3b 0x0c 0xc0 0xd0a (header)
and 
  python 3.1: magic=3151 = 0x0c4f (hex) =  0x4f 0x0c 0x0d 0x0a (header)
Comment 8 errata-xmlrpc 2016-11-04 03:36:21 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2491.html

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