[New-bugs-announce] [issue34668] test_resource fails if test has CAP_SYS_RESOURCE but isn't root

Benjamin Peterson report at bugs.python.org
Thu Sep 13 16:31:38 EDT 2018


New submission from Benjamin Peterson <benjamin at python.org>:

test_prlimit tries to test that raising the hardlimit of an unprivileged process. It tries to raise the hardlimit of pid 1, which usually raises a PermissionError. However, if the tests are privileged, this test can't work. The test tries to avoid this by only running the test if os.geteuid() != 0. However, there are other cases. For example, if the test process isn't root but has CAP_SYS_RESOURCE. While we could check for these other cases, I think we should just delete this test. There's no special logic in the prlimit implementation for handling permission errors, so it's not adding much value.

======================================================================
FAIL: test_prlimit (test.test_resource.ResourceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-alpine/build/Lib/test/support/__init__.py", line 587, in wrapper
    return func(*args, **kw)
  File "/buildbot/buildarea/3.x.ware-alpine/build/Lib/test/test_resource.py", line 152, in test_prlimit
    1, resource.RLIMIT_AS)
AssertionError: PermissionError not raised by prlimit

----------
components: Tests
messages: 325293
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: test_resource fails if test has CAP_SYS_RESOURCE but isn't root
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34668>
_______________________________________


More information about the New-bugs-announce mailing list