Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1195004 - libselinux-python3 calls os.path.walk
Summary: libselinux-python3 calls os.path.walk
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libselinux
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1024357
TreeView+ depends on / blocked
 
Reported: 2015-02-21 22:02 UTC by Miro Hrončok
Modified: 2015-05-10 23:59 UTC (History)
3 users (show)

Fixed In Version: libselinux-2.3-9.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-28 13:10:09 UTC
Type: Bug
Embargoed:


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

Description Miro Hrončok 2015-02-21 22:02:36 UTC
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 22:37:08 UTC
Should be replaced by https://docs.python.org/2/library/os.html#os.walk

Comment 2 Miro Hrončok 2015-02-21 22:49:05 UTC
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 23:40:34 UTC
Here is a scratch build with proposed fix.

http://koji.fedoraproject.org/koji/taskinfo?taskID=9020684

Comment 4 Miro Hrončok 2015-02-22 21:35:54 UTC
Created attachment 994296 [details]
Patch to fix this, so it works on both Pythons

Comment 6 Fedora Update System 2015-04-23 09:20:39 UTC
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 09:21:44 UTC
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 22:47:36 UTC
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 13:10:09 UTC
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 23:59:27 UTC
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.