Bug 1349954

Summary: libselinux-2.5-8.fc25 breaks libselinux-python (ImportError: No module named '_selinux')
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: libselinuxAssignee: Petr Lautrbach <plautrba>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: rawhideCC: dennis, dwalsh, fweimer, gwync, mgrepl, plautrba, robatino
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard: AcceptedBlocker
Fixed In Version: libselinux-2.5-8.fc25.x86_64 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-27 07:48:28 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: 1277284    

Description Adam Williamson 2016-06-24 16:01:17 UTC
Today's Rawhide compose failed to yield any images. Looking at the logs, it's clear that libselinux broke things. Here's a live image compose log:

https://kojipkgs.fedoraproject.org//work/tasks/284/14630284/mock_output.log

note the traceback:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/selinux/__init__.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named '_selinux'

This is clearly related to the libselinux-policy change in 2.5-8.fc25 which landed on the same day:

- Move _selinux.so to /usr/lib64/python*/site-packages

and is an automatic F25 Alpha blocker: "Bugs which entirely prevent the composition of one or more of the release-blocking images required to be built for a currently-pending (pre-)release" - https://fedoraproject.org/wiki/QA:SOP_blocker_bug_process#Automatic_blockers

Comment 1 Petr Lautrbach 2016-06-27 07:48:28 UTC
This is a problem related to the new swig-3.10. It changed a way how it creates modules with bindings so that a new module doesn't use imp.find_module('_selinux', [dirname(__file__)]) but  importlib.import_module('_selinux')

It means that even when libselinux-2.5-6.fc25 (which originally worked just find in Rawhide) was rebuilt, it stopped worked. I found it out second day after I built 2.5-7.fc25 because I tested it on my f24 with the old swig and everything worked just fine. It was fixed on Friday by 2.5-8.fc25 update.



# rpm -q libselinux
libselinux-2.5-7.fc25.x86_64

# python3 -c 'import selinux'
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/selinux/__init__.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named '_selinux'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.5/site-packages/selinux/__init__.py", line 21, in <module>
    _selinux = swig_import_helper()
  File "/usr/lib64/python3.5/site-packages/selinux/__init__.py", line 20, in swig_import_helper
    return importlib.import_module('_selinux')
  File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_selinux'

# dnf update
...

# rpm -q libselinux
libselinux-2.5-8.fc25.x86_64

# python3 -c 'import selinux'

#