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

skip tests that raise PermissionError in test_tarfile (non-root user on Android) #73367

Closed
xdegaye mannequin opened this issue Jan 6, 2017 · 6 comments
Closed

skip tests that raise PermissionError in test_tarfile (non-root user on Android) #73367

xdegaye mannequin opened this issue Jan 6, 2017 · 6 comments
Labels
3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Jan 6, 2017

BPO 29181
Nosy @gustaebel, @xdegaye, @serhiy-storchaka
PRs
  • bpo-29181: Skip test_tarfile tests on PermissionError raised by Android #4375
  • Files
  • test_tarfile.patch
  • issue29181_01.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-12.17:03:40.042>
    created_at = <Date 2017-01-06.16:31:35.929>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'skip tests that raise PermissionError in test_tarfile (non-root user on Android)'
    updated_at = <Date 2017-11-12.17:03:40.041>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-11-12.17:03:40.041>
    actor = 'xdegaye'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-12.17:03:40.042>
    closer = 'xdegaye'
    components = ['Tests']
    creation = <Date 2017-01-06.16:31:35.929>
    creator = 'xdegaye'
    dependencies = []
    files = ['46199', '46233']
    hgrepos = []
    issue_num = 29181
    keywords = ['patch']
    message_count = 6.0
    messages = ['284832', '284931', '284935', '284938', '285066', '306124']
    nosy_count = 3.0
    nosy_names = ['lars.gustaebel', 'xdegaye', 'serhiy.storchaka']
    pr_nums = ['4375']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29181'
    versions = ['Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 6, 2017

    ====================================================================== [339/2616]
    ERROR: test_link_size (test.test_tarfile.Bz2WriteTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1102, in test_link_siz
    e
        os.link(target, link)
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard
    ir/link_target' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/link'

    ======================================================================
    ERROR: test_link_size (test.test_tarfile.GzipWriteTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1102, in test_link_siz
    e
        os.link(target, link)
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard
    ir/link_target' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/link'

    ======================================================================
    ERROR: test_add_hardlink (test.test_tarfile.HardlinkTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1563, in setUp
        os.link(self.foo, self.bar)
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard
    ir/foo' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/bar'

    ======================================================================
    ERROR: test_add_twice (test.test_tarfile.HardlinkTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1563, in setUp
        os.link(self.foo, self.bar)
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard
    ir/foo' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/bar'

    ======================================================================
    ERROR: test_dereference_hardlink (test.test_tarfile.HardlinkTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1563, in setUp
        os.link(self.foo, self.bar)
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard
    ir/foo' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/bar'

    ======================================================================
    ERROR: test_link_size (test.test_tarfile.WriteTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1102, in test_link_siz
    e
        os.link(target, link)
    PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard
    ir/link_target' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/link'

    Ran 426 tests in 17.296s

    FAILED (errors=6, skipped=80)
    test test_tarfile failed

    @xdegaye xdegaye mannequin self-assigned this Jan 6, 2017
    @xdegaye xdegaye mannequin added 3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jan 6, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 7, 2017

    Patch attached.

    @serhiy-storchaka
    Copy link
    Member

    serhiy-storchaka commented Jan 7, 2017

    Why os.link() is failed? If hard links are not supported on Android, shouldn't os.link be not implemented? tarfile try to make a copy of the referenced file instead of a link if a link can't be created.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 7, 2017

    Why os.link() is failed? If hard links are not supported on Android, shouldn't os.link be not implemented?

    Android has a restrictive security model based on SELinux [1].

    With the Android adb shell on the emulator at API level 24:

    $ >foo
    $ ln foo bar
    ln: cannot create hard link from 'foo' to 'bar': Permission denied
    $ su
    # ln foo bar
    # ls -li foo bar
    15688 -rw-rw-rw- 2 shell shell 0 2017-01-07 22:29 bar
    15688 -rw-rw-rw- 2 shell shell 0 2017-01-07 22:29 foo

    Here is the Android commit message that does not grant hard link capabilities by default:
    https://android.googlesource.com/platform/external/sepolicy/+/85ce2c7

    [1] https://source.android.com/security/selinux/

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Jan 9, 2017

    New patch following Serhiy's suggestion in msg285008.

    @xdegaye xdegaye mannequin removed their assignment Feb 3, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 12, 2017

    New changeset d7d4fea by xdegaye in branch 'master':
    bpo-29181: Skip test_tarfile tests on PermissionError raised by Android (GH-4375)
    d7d4fea

    @xdegaye xdegaye mannequin closed this as completed Nov 12, 2017
    @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 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