Bug 1629978

Summary: Python can sometimes create incorrect .pyc files
Product: Red Hat Enterprise Linux 7 Reporter: Paulo Andrade <pandrade>
Component: pythonAssignee: Python Maintainers <python-maint>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: cstratak, hhorak, luis.fernandez.alvarez, pandrade, pviktori
Target Milestone: beta   
Target Release: 7.7   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1629982 (view as bug list) Environment:
Last Closed: 2018-10-22 09:19:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1629982    

Description Paulo Andrade 2018-09-17 17:43:24 UTC
User is affected by the bug described at https://bugs.python.org/issue25083
that causes the generation of empty .pyc files.

  With patch at https://github.com/python/cpython/commit/f64c813de84011a84ca21d75a294861a9cc2dfdc

Comment 2 Charalampos Stratakis 2018-09-17 17:50:47 UTC
If I recall correctly we didn't backport this patch to RHEL7 due to concerns with backwards compatibility. Petr could you confirm that?

Comment 3 Petr Viktorin (pviktori) 2018-09-18 09:10:04 UTC
Charris: no, this is a different issue than what you're thinking about. This one is not invasive.

The change adds error checking for the case when source for a Python module cannot be read (for example, on an unreliable networked filesystem).
Previously, this did not raise an error, but resulted in an empty bytecode cache file. The module can not be imported until the cache file is manually removed.
With the change, such compilation fails with an exception. This allows the user to detect the issue as it happens.


Note that while I'm sure the upstream patch is an improvement, I haven't checked if it addresses all instances of the issue. How important is this to the customer?
Also, testing this will be rather involved. As noted in the upstream issue, reliably reproducing the issue "involves LD_PRELOADing an dynamic library which hooks __srget".

Comment 4 Petr Viktorin (pviktori) 2018-09-20 12:51:40 UTC
I set the wrong needinfo. Paulo, can you answer the following?

> Note that while I'm sure the upstream patch is an improvement, I haven't checked if it addresses all instances of the issue. How important is this to the customer?


Also, it is probably too late now to backport this to RHEL 6 (Python 2.6).

Comment 10 Petr Viktorin (pviktori) 2018-10-22 09:19:06 UTC
Bug #1629982 tracks this for RHEL 7.

*** This bug has been marked as a duplicate of bug 1629982 ***