From: Jan Rękorajski Date: Sun, 22 Sep 2019 09:42:47 +0000 (+0200) Subject: - up to 4.2.2 X-Git-Tag: auto/th/setools-4.2.2-1 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=ffc3e54517d8706f07b8bdcbef076cebee5368f8;p=packages%2Fsetools.git - up to 4.2.2 - python2 support dropped upstream --- diff --git a/setools-format-truncation.patch b/setools-format-truncation.patch deleted file mode 100644 index 3ee3179..0000000 --- a/setools-format-truncation.patch +++ /dev/null @@ -1,98 +0,0 @@ -From e41adf01647c695b80b112b337e76021bb9f30c3 Mon Sep 17 00:00:00 2001 -From: Laurent Bigonville -Date: Tue, 26 Sep 2017 15:15:30 +0200 -Subject: [PATCH] Fix build failure with GCC 7 due to possible truncation of - snprintf output - -setools fails to build under GCC7 -Wformat -Werror with the following error: - -x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-sign-compare -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ilibqpol -Ilibqpol/include -I/usr/include/python3.6m -c libqpol/policy_extend.c -o build/temp.linux-amd64-3.6/libqpol/policy_extend.o -Werror -Wextra -Waggregate-return -Wfloat-equal -Wformat -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-include-dirs -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wunknown-pragmas -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-qual -Wno-shadow -Wno-unreachable-code -fno-exceptions -libqpol/policy_extend.c: In function 'policy_extend': -libqpol/policy_extend.c:161:27: error: '%04zd' directive output may be truncated writing between 4 and 10 bytes into a region of size 5 [-Werror=format-truncation=] - snprintf(buff, 9, "@ttr%04zd", i + 1); - ^~~~~ -libqpol/policy_extend.c:161:22: note: directive argument in the range [1, 4294967295] - snprintf(buff, 9, "@ttr%04zd", i + 1); - ^~~~~~~~~~~ - -Increase the size of the buffer to avoid collisions - -Closes: https://github.com/TresysTechnology/setools/issues/174 -Signed-off-by: Laurent Bigonville ---- - libqpol/policy_extend.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/libqpol/policy_extend.c b/libqpol/policy_extend.c -index 742819b..739e184 100644 ---- a/libqpol/policy_extend.c -+++ b/libqpol/policy_extend.c -@@ -110,7 +110,7 @@ static int qpol_policy_remove_bogus_aliases(qpol_policy_t * policy) - * Builds data for the attributes and inserts them into the policydb. - * This function modifies the policydb. Names created for attributes - * are of the form @ttr where value is the value of the attribute -- * as a four digit number (prepended with 0's as needed). -+ * as a ten digit number (prepended with 0's as needed). - * @param policy The policy from which to read the attribute map and - * create the type data for the attributes. This policy will be altered - * by this function. -@@ -125,7 +125,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy) - uint32_t bit = 0, count = 0; - ebitmap_node_t *node = NULL; - type_datum_t *tmp_type = NULL, *orig_type; -- char *tmp_name = NULL, buff[10]; -+ char *tmp_name = NULL, buff[16]; - int error = 0, retv; - - INFO(policy, "%s", "Generating attributes for policy. (Step 4 of 5)"); -@@ -137,7 +137,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy) - - db = &policy->p->p; - -- memset(&buff, 0, 10 * sizeof(char)); -+ memset(&buff, 0, 16 * sizeof(char)); - - for (i = 0; i < db->p_types.nprim; i++) { - /* skip types */ -@@ -158,7 +158,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy) - * with this attribute */ - /* Does not exist */ - if (db->p_type_val_to_name[i] == NULL){ -- snprintf(buff, 9, "@ttr%04zd", i + 1); -+ snprintf(buff, 15, "@ttr%010zd", i + 1); - tmp_name = strdup(buff); - if (!tmp_name) { - error = errno; -@@ -240,7 +240,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy) - * Builds data for empty attributes and inserts them into the policydb. - * This function modifies the policydb. Names created for the attributes - * are of the form @ttr where value is the value of the attribute -- * as a four digit number (prepended with 0's as needed). -+ * as a ten digit number (prepended with 0's as needed). - * @param policy The policy to which to add type data for attributes. - * This policy will be altered by this function. - * @return Returns 0 on success and < 0 on failure; if the call fails, -@@ -251,7 +251,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy) - static int qpol_policy_fill_attr_holes(qpol_policy_t * policy) - { - policydb_t *db = NULL; -- char *tmp_name = NULL, buff[10]; -+ char *tmp_name = NULL, buff[16]; - int error = 0, retv = 0; - ebitmap_t tmp_bmap = { NULL, 0 }; - type_datum_t *tmp_type = NULL; -@@ -265,12 +265,12 @@ static int qpol_policy_fill_attr_holes(qpol_policy_t * policy) - - db = &policy->p->p; - -- memset(&buff, 0, 10 * sizeof(char)); -+ memset(&buff, 0, 16 * sizeof(char)); - - for (i = 0; i < db->p_types.nprim; i++) { - if (db->type_val_to_struct[i]) - continue; -- snprintf(buff, 9, "@ttr%04zd", i + 1); -+ snprintf(buff, 15, "@ttr%010zd", i + 1); - tmp_name = strdup(buff); - if (!tmp_name) { - error = errno; diff --git a/setools.spec b/setools.spec index a9c5881..6e2c5ce 100644 --- a/setools.spec +++ b/setools.spec @@ -1,42 +1,23 @@ -# -# Conditional build: -%bcond_without python2 # Python 2.x modules -%bcond_without python3 # Python 3.x modules -# Summary: Policy analysis tools for SELinux Summary(pl.UTF-8): Narzędzia do analizy polityk SELinuksa Name: setools -Version: 4.1.1 +Version: 4.2.2 Release: 1 License: GPL v2+ (tools), LGPL v2.1+ (libraries) Group: Applications/System -#Source0Download: https://github.com/TresysTechnology/setools/releases -Source0: https://github.com/TresysTechnology/setools/archive/%{version}/%{name}-%{version}.tar.gz -# Source0-md5: 54cf5c0ca2aa4ef7c6ac153981af34cd -# https://github.com/TresysTechnology/setools/issues/174 -# https://github.com/bigon/setools/commit/e41adf01647c695b80b112b337e76021bb9f30c3.patch -Patch0: %{name}-format-truncation.patch +Source0: https://github.com/SELinuxProject/setools/releases/download/%{version}/%{name}-%{version}.tar.bz2 +# Source0-md5: f78fb10ec1fe189dfd27204549854cfa URL: https://github.com/TresysTechnology/setools4/wiki BuildRequires: bison BuildRequires: flex BuildRequires: libsepol-devel >= 2.7 BuildRequires: libsepol-static >= 2.7 -%if %{with python2} -BuildRequires: python-devel >= 1:2.7 -BuildRequires: python-setuptools -%endif -%if %{with python3} BuildRequires: python3-devel >= 1:3.3 BuildRequires: python3-setuptools -%endif BuildRequires: rpmbuild(macros) >= 1.714 BuildRequires: swig-python >= 2.0.12 Suggests: policy-sources -%if %{with python2} -Requires: python-setools = %{version}-%{release} -%else Requires: python3-setools = %{version}-%{release} -%endif BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description @@ -67,11 +48,7 @@ Summary(pl.UTF-8): Graficzne narzędzia do analizy polityk SELinuksa License: GPL v2+ Group: Applications/System Requires: %{name} = %{version}-%{release} -%if %{with python2} -Requires: python-setoolsgui = %{version}-%{release} -%else Requires: python3-setoolsgui = %{version}-%{release} -%endif %description gui SETools is a collection of graphical tools, command-line tools, and @@ -163,34 +140,19 @@ SETools GUI modules for Python 3. Moduły graficznego interfejsu użytkownika SETools dla Pythona 3. %prep -%setup -q -%patch0 -p1 +%setup -q -n %{name} %build export SEPOL=%{_libdir}/libsepol.a -%if %{with python2} -%py_build -%endif - -%if %{with python3} %py3_build -%endif %install rm -rf $RPM_BUILD_ROOT export SEPOL=%{_libdir}/libsepol.a -%if %{with python3} %py3_install -%endif - -%if %{with python2} -%py_install - -%py_postclean -%endif %clean rm -rf $RPM_BUILD_ROOT @@ -213,34 +175,12 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %{_bindir}/apol %{_mandir}/man1/apol.1* -%if %{with python2} -%files -n python-setools -%defattr(644,root,root,755) -%doc COPYING ChangeLog KNOWN-BUGS README.md -%dir %{py_sitedir}/setools -%{py_sitedir}/setools/diff -%dir %{py_sitedir}/setools/policyrep -%attr(755,root,root) %{py_sitedir}/setools/policyrep/_qpol.so -%{py_sitedir}/setools/policyrep/*.py[co] -%{py_sitedir}/setools/*.py[co] -%{py_sitedir}/setools/perm_map -%{py_sitedir}/setools-%{version}-py*.egg-info - -%files -n python-setoolsgui -%defattr(644,root,root,755) -%{py_sitedir}/setoolsgui -%endif - -%if %{with python3} %files -n python3-setools %defattr(644,root,root,755) %doc COPYING ChangeLog KNOWN-BUGS README.md %dir %{py3_sitedir}/setools %{py3_sitedir}/setools/diff -%dir %{py3_sitedir}/setools/policyrep -%attr(755,root,root) %{py3_sitedir}/setools/policyrep/_qpol.cpython-*.so -%{py3_sitedir}/setools/policyrep/*.py -%{py3_sitedir}/setools/policyrep/__pycache__ +%attr(755,root,root) %{py3_sitedir}/setools/policyrep.cpython-*.so %{py3_sitedir}/setools/*.py %{py3_sitedir}/setools/perm_map %{py3_sitedir}/setools/__pycache__ @@ -249,4 +189,3 @@ rm -rf $RPM_BUILD_ROOT %files -n python3-setoolsgui %defattr(644,root,root,755) %{py3_sitedir}/setoolsgui -%endif