14
0
2025-06-10 15:03:42 +00:00
committed by Git OBS Bridge
commit b29143ed03
15 changed files with 404 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

41
COPYING Normal file
View File

@@ -0,0 +1,41 @@
python-prctl - A python(ic) interface to the prctl syscall
Copyright (C) 2010-2020 Dennis Kaarsemaker <dennis@kaarsemaker.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------
The documentation is heavily based on the linux manpages prctl and
capabilities, which is covered by the following license:
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one
Since the Linux kernel and libraries are constantly changing, this
manual page may be incorrect or out-of-date. The author(s) assume no
responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein. The author(s) may not
have taken the same level of care in the production of this manual,
which is licensed free of charge, as they might when working
professionally.
Formatted or processed versions of this manual, if unaccompanied by
the source, must acknowledge the copyright and authors of this work.
License.

27
bigendian.patch Normal file
View File

@@ -0,0 +1,27 @@
Index: python-prctl-1.8.1/_prctlmodule.c
===================================================================
--- python-prctl-1.8.1.orig/_prctlmodule.c
+++ python-prctl-1.8.1/_prctlmodule.c
@@ -51,6 +51,7 @@ prctl_prctl(PyObject *self, PyObject *ar
long option = 0;
long arg = 0;
long arg2 = 0;
+ int intarg = 0;
char *argstr = NULL;
char name[17] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
int result;
@@ -378,12 +379,12 @@ prctl_prctl(PyObject *self, PyObject *ar
#ifdef PR_GET_TID_ADDRESS
case(PR_GET_TID_ADDRESS):
#endif
- result = prctl(option, &arg, 0, 0, 0);
+ result = prctl(option, &intarg, 0, 0, 0);
if(result < 0) {
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
- return PyInt_FromLong(arg);
+ return PyInt_FromLong(intarg);
case(PR_SET_NAME):
case(PR_GET_NAME):
result = prctl(option, name, 0, 0, 0);

View File

@@ -0,0 +1,13 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -20,7 +20,7 @@ except ImportError:
pass
curdir = os.path.dirname(__file__)
-builddir = os.path.join(curdir, 'build', 'lib.%s-%s' % (distutils.util.get_platform(), sys.version[0:3]))
+builddir = os.path.join(curdir, 'build', 'lib.%s-%s' % (distutils.util.get_platform(), '.'.join([str(x) for x in sys.version_info[:2]])))
# Always run from the builddir
if not os.path.exists(builddir) or \

View File

@@ -0,0 +1,13 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -245,7 +245,7 @@ class PrctlTest(unittest.TestCase):
@require('mpx_enable_management')
def test_mpx(self):
"""Test MPX enabling/disabling"""
- if os.uname().release > "5.4":
+ if tuple(int(x) for x in os.uname().release.split('.')[:2]) > (5, 4):
self.assertRaises(OSError, prctl.mpx_enable_management)
self.assertRaises(OSError, prctl.mpx_disable_management)
else:

View File

@@ -0,0 +1,12 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -240,6 +240,7 @@ class PrctlTest(unittest.TestCase):
else:
self.assertRaises(OSError, prctl.pac_reset_keys, prctl.PAC_APIAKEY)
+ @unittest.skip('borked in sandbox')
def test_proctitle(self):
"""Test setting the process title, including too long titles"""
with open('/proc/self/cmdline') as fd:

View File

@@ -0,0 +1,12 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -259,6 +259,7 @@ class PrctlTest(unittest.TestCase):
self.assertEqual(prctl.get_name(), name[:15])
@require('get_no_new_privs')
+ @unittest.skip('test fails, because ping doesn\'t use capabilities anymore (boo#1174504)')
def test_no_new_privs(self):
"""Test the no_new_privs function"""
self.assertEqual(prctl.get_no_new_privs(), 0)

20
dont-check-builddir.patch Normal file
View File

@@ -0,0 +1,20 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -22,15 +22,6 @@ except ImportError:
curdir = os.path.dirname(__file__)
builddir = os.path.join(curdir, 'build', 'lib.%s-%s' % (distutils.util.get_platform(), '.'.join([str(x) for x in sys.version_info[:2]])))
-# Always run from the builddir
-if not os.path.exists(builddir) or \
- not os.path.exists(os.path.join(builddir, 'prctl.py')) or \
- not os.path.exists(os.path.join(builddir, '_prctl' + so)) or \
- int(os.path.getmtime(os.path.join(curdir, 'prctl.py'))) > int(os.path.getmtime(os.path.join(builddir, 'prctl.py'))) or \
- os.path.getmtime(os.path.join(curdir, '_prctlmodule.c')) > os.path.getmtime(os.path.join(builddir, '_prctl' + so)):
- sys.stderr.write("Please build the extension first, using ./setup.py build\n")
- sys.exit(1)
-sys.path.insert(0, builddir)
import prctl
import _prctl

View File

@@ -0,0 +1,12 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -182,6 +182,7 @@ class PrctlTest(unittest.TestCase):
self.assertEqual(prctl.get_keepcaps(), False)
@require('set_mce_kill')
+ @unittest.skipIf(sys.maxsize <= 2**32 or arch == 's390x', 'no such file on this architecture')
def test_mce_kill(self):
"""Test the MCE_KILL setting"""
if not os.path.exists('/proc/sys/vm/memory_failure_early_kill'):

80
powerpc.patch Normal file
View File

@@ -0,0 +1,80 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -45,6 +45,8 @@ def require(attr):
class PrctlTest(unittest.TestCase):
# There are architecture specific tests
arch = os.uname()[4]
+ if arch == 'ppc' or arch == 'ppc64' or arch == 'ppc64le':
+ arch = 'powerpc'
# prctl behaviour differs when root, so you should test as root and non-root
am_root = os.geteuid() == 0
@@ -111,6 +113,7 @@ class PrctlTest(unittest.TestCase):
self.assertEqual(prctl.get_dumpable(), False)
self.assertRaises(TypeError, prctl.get_dumpable, "42")
+ @unittest.skip('cannot change endianness of running python interpreter')
def test_endian(self):
"""Test manipulation of the endianness setting"""
if self.arch == 'powerpc':
@@ -137,13 +140,55 @@ class PrctlTest(unittest.TestCase):
self.assertRaises(OSError, prctl.get_fpemu)
self.assertRaises(OSError, prctl.set_fpemu, prctl.FPEMU_SIGFPE)
+# define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */
+# define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */
+# define PR_FP_EXC_OVF 0x020000 /* floating point overflow */
+# define PR_FP_EXC_UND 0x040000 /* floating point underflow */
+# define PR_FP_EXC_RES 0x080000 /* floating point inexact result */
+# define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */
+# define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */
+# define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */
+# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */
+# define PR_FP_EXC_PRECISE 3 /* precise exception mode */
+ def print_fpexc(self, fpexc):
+ if fpexc == 0:
+ print("PR_FP_EXC_DISABLED")
+ else:
+ if fpexc & 3 == _prctl.PR_FP_EXC_ASYNC:
+ print('PR_FP_EXC_ASYNC')
+ if fpexc & 3 == _prctl.PR_FP_EXC_NONRECOV:
+ print('PR_FP_EXC_NONRECOV')
+ if fpexc & 3 == _prctl.PR_FP_EXC_PRECISE:
+ print('PR_FP_EXC_PRECISE')
+ if fpexc & prctl.PR_FP_EXC_SW_ENABLE:
+ print('PR_FP_EXC_SW_ENABLE')
+ if fpexc & _prctl.PR_FP_EXC_DIV:
+ print('PR_FP_EXC_DIV')
+ if fpexc & _prctl.PR_FP_EXC_OVF:
+ print('PR_FP_EXC_OVF')
+ if fpexc & _prctl.PR_FP_EXC_UND:
+ print('PR_FP_EXC_UND')
+ if fpexc & _prctl.PR_FP_EXC_RES:
+ print('PR_FP_EXC_RES')
+ if fpexc & _prctl.PR_FP_EXC_INV:
+ print('PR_FP_EXC_INV')
+ print('\n');
+
def test_fpexc(self):
"""Test manipulation of the fpexc setting"""
if self.arch == 'powerpc':
- # FIXME - untested
- prctl.set_fpexc(prctl.FP_EXC_SW_ENABLE)
- self.assertEqual(prctl.get_fpexc() & prctl.PR_FP_EXC_SW_ENABLE, prctl.PR_FP_EXC_SW_ENABLE)
+ fpexc = prctl.get_fpexc()
+ self.print_fpexc(fpexc)
+ # Did not find a sane combination of flags that is supported.
+ self.assertRaises(OSError, prctl.set_fpexc,
+ prctl.FP_EXC_SW_ENABLE | _prctl.PR_FP_EXC_ASYNC | _prctl.PR_FP_EXC_DIV | _prctl.PR_FP_EXC_INV)
+ self.print_fpexc(prctl.get_fpexc())
+ self.assertEqual(prctl.get_fpexc(), fpexc)
+ prctl.set_fpexc(_prctl.PR_FP_EXC_DISABLED)
+ self.print_fpexc(prctl.get_fpexc())
+ self.assertEqual(prctl.get_fpexc(), _prctl.PR_FP_EXC_DISABLED)
self.assertRaises(ValueError, prctl.set_fpexc, 999)
+ prctl.set_fpexc(fpexc)
else:
self.assertRaises(OSError, prctl.get_fpexc)
self.assertRaises(OSError, prctl.set_fpexc)

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b4ca9a25a7d4f1ace4fffd1f3a2e64ef5208fe05f929f3edd5e27081ca7e67ce
size 28033

View File

@@ -0,0 +1,57 @@
-------------------------------------------------------------------
Tue Jun 10 15:01:50 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to pip-based build
-------------------------------------------------------------------
Fri Oct 7 07:39:38 UTC 2022 - Markéta Machová <mmachova@suse.com>
- Add patch dont-check-builddir.patch
* The check whether the tests run in builddir is broken, turn it off
and assume everything is fine (we would see it if not).
-------------------------------------------------------------------
Thu Feb 17 05:33:37 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.8.1:
* No changelog.
- Rebase all patches.
- Add patch correct-uname-comparsion.patch:
* Support Linux >= 5.10 correctly.
- Add patch check-for-python310-correctly.patch:
* Check for Python 3.10 correctly.
- Add patch skip-speculation.patch:
* Skip a test that does not work in the OBS sandbox.
-------------------------------------------------------------------
Tue Oct 27 09:54:52 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net>
- Disable test of no_new_privs with disable_no_new_privs.patch
test fails, because ping doesn't use capabilities anymore (boo#1174504)
-------------------------------------------------------------------
Fri Sep 4 13:48:25 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Fixing arch-dependent test failures (bsc#1176085):
* renamed failing-on-i586.patch to memory_failure_early_kill.patch
* and modified it to skip the test also on s390x
* added bigendian.patch
* added powerpc.patch
* huge thanks to Michal Suchánek
-------------------------------------------------------------------
Wed Aug 19 07:46:50 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Add failing-on-i586.patch to disable failing i586 test
-------------------------------------------------------------------
Tue Aug 11 07:51:14 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to disable test failing in sandbox:
https://github.com/seveas/python-prctl/issues/17
* disable-sandboxed-test.patch
-------------------------------------------------------------------
Tue Aug 11 07:37:51 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Initial commit jsc#SLE-13272

78
python-python-prctl.spec Normal file
View File

@@ -0,0 +1,78 @@
#
# spec file for package python-python-prctl
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: python-python-prctl
Version: 1.8.1
Release: 0
Summary: Python(ic) interface to the linux prctl syscall
License: GPL-3.0-or-later
URL: https://github.com/seveas/python-prctl
Source: https://files.pythonhosted.org/packages/source/p/python-prctl/python-prctl-%{version}.tar.gz
Source99: https://raw.githubusercontent.com/seveas/python-prctl/master/COPYING
Patch0: disable-sandboxed-test.patch
Patch1: memory_failure_early_kill.patch
Patch2: bigendian.patch
Patch3: powerpc.patch
Patch4: disable_no_new_privs.patch
Patch5: correct-uname-comparsion.patch
Patch6: check-for-python310-correctly.patch
Patch7: skip-speculation.patch
Patch8: dont-check-builddir.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: iputils
BuildRequires: pkgconfig
BuildRequires: procps
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(libcap)
%python_subpackages
%description
The linux prctl function allows you to control specific characteristics of a
process' behaviour. Usage of the function is fairly messy though, due to
limitations in C and linux. This module provides a nice non-messy python(ic)
interface.
Besides prctl, this library also wraps libcap for complete capability handling
and allows you to set the process name as seen in ps and top.
%prep
%autosetup -p1 -n python-prctl-%{version}
cp %{SOURCE99} .
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python test_prctl.py
%files %{python_files}
%license COPYING
%doc README
%{python_sitearch}/prctl.py
%{python_sitearch}/python[-_]prctl-%{version}*-info
%pycache_only %{python_sitearch}/__pycache__/prctl*
%changelog

12
skip-speculation.patch Normal file
View File

@@ -0,0 +1,12 @@
Index: python-prctl-1.8.1/test_prctl.py
===================================================================
--- python-prctl-1.8.1.orig/test_prctl.py
+++ python-prctl-1.8.1/test_prctl.py
@@ -371,6 +371,7 @@ class PrctlTest(unittest.TestCase):
self.assertRaises(OSError, set_true)
@require('set_speculation_ctrl')
+ @unittest.skip('borked in sandbox')
def test_speculation_ctrl(self):
self.assertTrue(prctl.get_speculation_ctrl(prctl.SPEC_STORE_BYPASS) > 0)
self.assertTrue(prctl.get_speculation_ctrl(prctl.SPEC_INDIRECT_BRANCH) > 0)