From f355a62016027aa80032d7151fc373a5b46b0f30 Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Sun, 28 Aug 2022 10:29:29 +0800 Subject: selinux-python: upgrade 3.3 -> 3.4 * Backport a patch to fix chcat runtime error. * Refresh patch. Signed-off-by: Yi Zhao Signed-off-by: Joe MacDonald --- ...ext-handle-unsupported-languages-properly.patch | 173 +++++++++++++++++++++ .../selinux-python/fix-sepolicy-install-path.patch | 4 +- 2 files changed, 175 insertions(+), 2 deletions(-) create mode 100644 recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch (limited to 'recipes-security/selinux/selinux-python') diff --git a/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch b/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch new file mode 100644 index 0000000..b83300d --- /dev/null +++ b/recipes-security/selinux/selinux-python/0001-gettext-handle-unsupported-languages-properly.patch @@ -0,0 +1,173 @@ +From 4693794ff8c52f87a4abdb68fe9dae6618023c03 Mon Sep 17 00:00:00 2001 +From: Vit Mojzis +Date: Fri, 24 Jun 2022 16:24:25 +0200 +Subject: [PATCH] gettext: handle unsupported languages properly + +With "fallback=True" gettext.translation behaves the same as +gettext.install and uses NullTranslations in case the +translation file for given language was not found (as opposed to +throwing an exception). + +Fixes: + # LANG is set to any "unsupported" language, e.g. en_US.UTF-8 + $ chcat --help + Traceback (most recent call last): + File "/usr/bin/chcat", line 39, in + t = gettext.translation(PROGNAME, + File "/usr/lib64/python3.9/gettext.py", line 592, in translation + raise FileNotFoundError(ENOENT, + FileNotFoundError: [Errno 2] No translation file found for domain: 'selinux-python' + +Signed-off-by: Vit Mojzis +Reviewed-by: Daniel Burgener +Acked-by: Petr Lautrbach + +Upstream-Status: Backport +[https://github.com/SELinuxProject/selinux/commit/344463076b2a91e1d2c7f5cc3835dc1a53a05e88] + +Signed-off-by: Yi Zhao +--- + chcat/chcat | 5 +++-- + semanage/semanage | 3 ++- + semanage/seobject.py | 3 ++- + sepolgen/src/sepolgen/sepolgeni18n.py | 4 +++- + sepolicy/sepolicy.py | 3 ++- + sepolicy/sepolicy/__init__.py | 3 ++- + sepolicy/sepolicy/generate.py | 3 ++- + sepolicy/sepolicy/gui.py | 3 ++- + sepolicy/sepolicy/interface.py | 3 ++- + 9 files changed, 20 insertions(+), 10 deletions(-) + +diff --git a/chcat/chcat b/chcat/chcat +index e779fcc..952cb81 100755 +--- a/chcat/chcat ++++ b/chcat/chcat +@@ -38,9 +38,10 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext +-except ImportError: ++except: + try: + import builtins + builtins.__dict__['_'] = str +diff --git a/semanage/semanage b/semanage/semanage +index 8f4e44a..f45061a 100644 +--- a/semanage/semanage ++++ b/semanage/semanage +@@ -38,7 +38,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +diff --git a/semanage/seobject.py b/semanage/seobject.py +index ff8f4e9..0782c08 100644 +--- a/semanage/seobject.py ++++ b/semanage/seobject.py +@@ -42,7 +42,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +diff --git a/sepolgen/src/sepolgen/sepolgeni18n.py b/sepolgen/src/sepolgen/sepolgeni18n.py +index 56ebd80..1ff307d 100644 +--- a/sepolgen/src/sepolgen/sepolgeni18n.py ++++ b/sepolgen/src/sepolgen/sepolgeni18n.py +@@ -19,7 +19,9 @@ + + try: + import gettext +- t = gettext.translation( 'selinux-python' ) ++ t = gettext.translation("selinux-python", ++ localedir="/usr/share/locale", ++ fallback=True) + _ = t.gettext + except: + def _(str): +diff --git a/sepolicy/sepolicy.py b/sepolicy/sepolicy.py +index 7ebe0ef..c7a70e0 100755 +--- a/sepolicy/sepolicy.py ++++ b/sepolicy/sepolicy.py +@@ -36,7 +36,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +diff --git a/sepolicy/sepolicy/__init__.py b/sepolicy/sepolicy/__init__.py +index 7208234..9c3caa0 100644 +--- a/sepolicy/sepolicy/__init__.py ++++ b/sepolicy/sepolicy/__init__.py +@@ -31,7 +31,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +diff --git a/sepolicy/sepolicy/generate.py b/sepolicy/sepolicy/generate.py +index 67189fc..3717d5d 100644 +--- a/sepolicy/sepolicy/generate.py ++++ b/sepolicy/sepolicy/generate.py +@@ -56,7 +56,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +diff --git a/sepolicy/sepolicy/gui.py b/sepolicy/sepolicy/gui.py +index b026374..5bdbfeb 100644 +--- a/sepolicy/sepolicy/gui.py ++++ b/sepolicy/sepolicy/gui.py +@@ -49,7 +49,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +diff --git a/sepolicy/sepolicy/interface.py b/sepolicy/sepolicy/interface.py +index 599f97f..43f8644 100644 +--- a/sepolicy/sepolicy/interface.py ++++ b/sepolicy/sepolicy/interface.py +@@ -38,7 +38,8 @@ try: + kwargs['unicode'] = True + t = gettext.translation(PROGNAME, + localedir="/usr/share/locale", +- **kwargs) ++ **kwargs, ++ fallback=True) + _ = t.gettext + except: + try: +-- +2.25.1 + diff --git a/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch b/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch index 4e91df7..bd14450 100644 --- a/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch +++ b/recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch @@ -1,4 +1,4 @@ -From df40fadfb251cc2aebdbd2e216f99a8ae7da7763 Mon Sep 17 00:00:00 2001 +From d43220e336edf8ccaaa7bd3eb9c13874ed34d468 Mon Sep 17 00:00:00 2001 From: Xin Ouyang Date: Mon, 23 Sep 2013 21:17:59 +0800 Subject: [PATCH] sepolicy: fix install path for new pymodule sepolicy @@ -26,5 +26,5 @@ index 3361be4..5842321 100644 install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy (cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen) -- -2.17.1 +2.25.1 -- cgit v1.2.3-54-g00ecf