New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
access to mkfifo, mknod and hard links is controled by SELinux MAC on Android #72945
Comments
List of the tests that fail with PermissionError when run as a non-root user on an Android emulator (API 24) and fixed by this patch: |
New changeset 43f9366d8883 by Xavier de Gaye in branch '3.6': New changeset db1d20825d71 by Xavier de Gaye in branch 'default': |
Re-opening the issue for a more generic change that skips the tests when PermissionError is raised instead of when they are run by an Android non-root user as this is done currently after the previously pushed changes. |
I think it is worth to add special helper in test.support for using as a context manager: with helper():
os.mkfifo(filename) Then you could change its implementation without changing the testing code. For example: @contextmanager
def helper():
try:
yield
except PermissionError as e:
raise unittest.SkipTest(str(e)) or @contextmanager
def helper():
if android_not_root:
raise unittest.SkipTest("operation not allowed, non root user")
yield |
Oops, no bpo-28764 is not relevant here. |
New patch following Serhiy's suggestion in msg285008. |
I don't know what is a good name for such helper. supported_operation() looks too general. Maybe ask on Python-Dev? |
'supported_operation':
[1] https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html |
The purpose of this helper is skipping the test rather than failing if some OS operation is not permitted by current configuration. May be skip_if_not_permitted()? Similar helpers that convert runtime error in skipping a test: import_module(), get_attribute(), bind_unix_socket(), system_must_validate_cert(). They are more concrete, guard some specific operation. Context manager is not the only possible syntax. The helper can call a function: helper(os.mkfifo, filename) or be a wrapper:
If you prefer such syntax. There are many possibilities, and I think it is worth to discuss this on Python-Dev. |
Please go ahead and start the discussion on Python-Dev. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: