Summary: | sys-apps/portage selinux code still requires python-2 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Sven Vermeulen (RETIRED) <swift> |
Component: | SELinux | Assignee: | Sven Vermeulen (RETIRED) <swift> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | andreis.vinogradovs, dev-portage, docs-team, ibuyandtrade0+bugs.gentoo.org |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 741194 | ||
Attachments: | portage.patch |
Description
Sven Vermeulen (RETIRED)
![]() Created attachment 335564 [details, diff]
portage.patch
Source code generated by SWIG seems to imply that these functions require bytes in Python 2 and unicode in Python 3. Please test this patch.
(In reply to comment #1) > Created attachment 335564 [details, diff] [details, diff] > portage.patch > > Source code generated by SWIG seems to imply that these functions require > bytes in Python 2 and unicode in Python 3. Please test this patch. I've tested it with libselinux-2.1.12-r2 and python-3.2.3, and it seems to work fine, so I've committed the patch: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6137290b2bb8353db0df1a7664e435ced37bacfd I'm not sure how the libselinux functions will handle encoding/decoding of UTF-8 file names, and whether or not it's locale dependent. For these reasons, it would be nice if libselinux functions could handle file names encoded as raw bytes (like python's os.* functions do). (In reply to comment #2) > I've tested it with libselinux-2.1.12-r2 and python-3.2.3, and it seems to > work fine, so I've committed the patch: > > http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit; > h=6137290b2bb8353db0df1a7664e435ced37bacfd Released in portage-2.1.11.41 and 2.2.0_alpha152. (In reply to comment #2) > I'm not sure how the libselinux functions will handle encoding/decoding of > UTF-8 file names, and whether or not it's locale dependent. To follow up on this, Arfrever tells me SWIG-generated code uses the following function to encode unicode strings as bytes: http://docs.python.org/3/c-api/unicode.html#PyUnicode_AsUTF8String This is good news, because it's consistent with portage, which uses UTF-8 encoding for file names of all installed files (regardless of locale). > For these > reasons, it would be nice if libselinux functions could handle file names > encoded as raw bytes (like python's os.* functions do). While this might be a nice enhancement, it won't really matter for portage, because of the portage's consistency with PyUnicode_AsUTF8String. So, it seems that we can consider this bug fixed with portage-2.1.11.41 and 2.2.0_alpha152. Thanks, i can confirm it is working well. I've removed the python2 use force in the SELinux profiles. |