Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 695237 Details for
Bug 908916
python bindings traceback with cryptic error when unicode type is given
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Second try at patch to fix the python functions for unicode strings
libselinux-python-unicode.patch (text/plain), 1.90 KB, created by
Toshio Ernie Kuratomi
on 2013-02-08 21:25:52 UTC
(
hide
)
Description:
Second try at patch to fix the python functions for unicode strings
Filename:
MIME Type:
Creator:
Toshio Ernie Kuratomi
Created:
2013-02-08 21:25:52 UTC
Size:
1.90 KB
patch
obsolete
>Index: libselinux-2.1.13/src/selinuxswig_python.i >=================================================================== >--- libselinux-2.1.13.orig/src/selinuxswig_python.i >+++ libselinux-2.1.13/src/selinuxswig_python.i >@@ -8,11 +8,21 @@ > > %pythoncode %{ > >-import shutil, os, stat >+import locale, shutil, os, stat >+ >+try: >+ from kitchen import to_bytes >+except ImportError: >+ # Very simple version of to_bytes, sufficient for our purposes >+ def to_bytes(text, encoding='utf-8', errors='replace'): >+ if isinstance(text, unicode): >+ return text.encode(encoding, errors=errors) >+ return text > > def restorecon(path, recursive=False): > """ Restore SELinux context on a given path """ > >+ path = to_bytes(path, encoding=locale.getpreferredencoding(), errors='strict') > try: > mode = os.lstat(path)[stat.ST_MODE] > status, context = matchpathcon(path, mode) >@@ -33,6 +43,7 @@ def restorecon(path, recursive=False): > > def chcon(path, context, recursive=False): > """ Set the SELinux context on a given path """ >+ path = to_bytes(path, encoding=locale.getpreferredencoding(), errors='strict') > lsetfilecon(path, context) > if recursive: > for root, dirs, files in os.walk(path): >@@ -41,11 +52,15 @@ def chcon(path, context, recursive=False > > def copytree(src, dest): > """ An SELinux-friendly shutil.copytree method """ >+ src = to_bytes(src, encoding=locale.getpreferredencoding(), errors='strict') >+ dest = to_bytes(dest, encoding=locale.getpreferredencoding(), errors='strict') > shutil.copytree(src, dest) > restorecon(dest, recursive=True) > > def install(src, dest): > """ An SELinux-friendly shutil.move method """ >+ src = to_bytes(src, encoding=locale.getpreferredencoding(), errors='strict') >+ dest = to_bytes(dest, encoding=locale.getpreferredencoding(), errors='strict') > shutil.move(src, dest) > restorecon(dest, recursive=True) > %}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 908916
:
694748
| 695237