Skip to content
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

[asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user #72870

Closed
xdegaye mannequin opened this issue Nov 13, 2016 · 5 comments
Closed
Labels
3.7 expert-asyncio tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Nov 13, 2016

BPO 28684
Nosy @vstinner, @xdegaye, @1st1
PRs
  • bpo-28684: asyncio tests now handle PermissionError raised when bindi… #4503
  • bpo-28684: Remove useless import added by the previous commit #4547
  • Files
  • test_asyncio.log
  • test_asyncio_bind.patch
  • 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:

    assignee = None
    closed_at = <Date 2017-11-24.16:36:58.383>
    created_at = <Date 2016-11-13.20:39:34.110>
    labels = ['3.7', 'type-bug', 'tests', 'expert-asyncio']
    title = '[asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user'
    updated_at = <Date 2017-11-24.17:56:24.898>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-11-24.17:56:24.898>
    actor = 'xdegaye'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-24.16:36:58.383>
    closer = 'xdegaye'
    components = ['Tests', 'asyncio']
    creation = <Date 2016-11-13.20:39:34.110>
    creator = 'xdegaye'
    dependencies = []
    files = ['45476', '45518']
    hgrepos = []
    issue_num = 28684
    keywords = ['patch']
    message_count = 5.0
    messages = ['280714', '280769', '281038', '306904', '306911']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'xdegaye', 'yselivanov']
    pr_nums = ['4503', '4547']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue28684'
    versions = ['Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 13, 2016

    Tests in test_asyncio fail on Android when bind() on a unix socket raises PermissionError for a non-root user. See the attached test_asyncio.log. See also bpo-28683 and its patch(es).

    @xdegaye xdegaye mannequin added 3.7 tests Tests in the Lib/test dir expert-asyncio type-bug An unexpected behavior, bug, or error labels Nov 13, 2016
    @vstinner
    Copy link
    Member

    vstinner commented Nov 14, 2016

    I suggest to write a decorator in Lib/asyncio/test_utils.py to skip AF_UNIX tests on Android if os.getuid() != 0.

    Another approach is to catch the PermissionError and re-raises an unittest.SkipTest. Begin by modifying unix_socket_path() context manager in Lib/asyncio/test_utils.py.

    I prefer the approach catching PermissionError: it allows to run unit tests on a flavor of Android which doesn't raise PermissionError, and it handles PermissionError on other platforms.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 17, 2016

    With this patch, test_asyncio runs successfully with no ResourceWarning when run on the android-24 emulator.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 24, 2017

    New changeset 0f86cd3 by xdegaye in branch 'master':
    bpo-28684: asyncio tests handle PermissionError raised on binding unix sockets (GH-4503)
    0f86cd3

    @xdegaye xdegaye mannequin closed this as completed Nov 24, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 24, 2017

    New changeset 5742f67 by xdegaye in branch 'master':
    bpo-28684: Remove useless import added by the previous commit (GH-4547)
    5742f67

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 expert-asyncio tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant