Bug 1195004 - libselinux-python3 calls os.path.walk
libselinux-python3 calls os.path.walk
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: libselinux (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 1024357
  Show dependency treegraph
 
Reported: 2015-02-21 17:02 EST by Miro Hrončok
Modified: 2015-05-10 19:59 EDT (History)
3 users (show)

See Also:
Fixed In Version: libselinux-2.3-9.fc21
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-04-28 09:10:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to fix this, so it works on both Pythons (745 bytes, patch)
2015-02-22 16:35 EST, Miro Hrončok
no flags Details | Diff

  None (edit)
Description Miro Hrončok 2015-02-21 17:02:36 EST
Description of problem:
There is a Python 3 not compatible code in libselinux-python3

Version-Release number of selected component (if applicable):
libselinux-python3-2.3-5.fc21.x86_64
libselinux-python3-2.3-6.fc22

How reproducible:
Always


Actual results:
When running that part of code, exception occurs:

    File "/usr/lib64/python3.4/site-packages/selinux/__init__.py", line 95, in restorecon
    os.path.walk(path, lambda arg, dirname, fnames:
    AttributeError: 'module' object has no attribute 'walk'

Expected results:
 Should use os.walk on Python 3.

Additional info:
In here: https://github.com/SELinuxProject/selinux/blob/master/libselinux/src/selinuxswig_python.i#L34
Comment 1 Miro Hrončok 2015-02-21 17:37:08 EST
Should be replaced by https://docs.python.org/2/library/os.html#os.walk
Comment 2 Miro Hrončok 2015-02-21 17:49:05 EST
If I understand the call correctly, it could be replaced by:

        if recursive:
            for root, dirs, files in os.walk(path):
                for fname in files + dirs:
                   restorecon(os.path.join(root,fname))
Comment 3 Miro Hrončok 2015-02-21 18:40:34 EST
Here is a scratch build with proposed fix.

http://koji.fedoraproject.org/koji/taskinfo?taskID=9020684
Comment 4 Miro Hrončok 2015-02-22 16:35:54 EST
Created attachment 994296 [details]
Patch to fix this, so it works on both Pythons
Comment 6 Fedora Update System 2015-04-23 05:20:39 EDT
libselinux-2.3-9.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/libselinux-2.3-9.fc22
Comment 7 Fedora Update System 2015-04-23 05:21:44 EDT
libselinux-2.3-9.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/libselinux-2.3-9.fc21
Comment 8 Fedora Update System 2015-04-24 18:47:36 EDT
Package libselinux-2.3-9.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libselinux-2.3-9.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-6771/libselinux-2.3-9.fc21
then log in and leave karma (feedback).
Comment 9 Fedora Update System 2015-04-28 09:10:09 EDT
libselinux-2.3-9.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Fedora Update System 2015-05-10 19:59:27 EDT
libselinux-2.3-9.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

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