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

the chown() method of the tarfile.TarFile class fails on Android #71124

Closed
xdegaye mannequin opened this issue May 3, 2016 · 4 comments
Closed

the chown() method of the tarfile.TarFile class fails on Android #71124

xdegaye mannequin opened this issue May 3, 2016 · 4 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented May 3, 2016

BPO 26937
Nosy @gustaebel, @xdegaye, @moreati
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • pwd_grp.patch
  • pwd_grp_2.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 = 'https://github.com/xdegaye'
    closed_at = <Date 2016-12-09.09:14:36.193>
    created_at = <Date 2016-05-03.15:14:27.885>
    labels = ['3.7', 'type-bug', 'library']
    title = 'the chown() method of the tarfile.TarFile class fails on Android'
    updated_at = <Date 2017-03-31.16:36:12.052>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:12.052>
    actor = 'dstufft'
    assignee = 'xdegaye'
    closed = True
    closed_date = <Date 2016-12-09.09:14:36.193>
    closer = 'xdegaye'
    components = ['Library (Lib)']
    creation = <Date 2016-05-03.15:14:27.885>
    creator = 'xdegaye'
    dependencies = []
    files = ['42847', '45282']
    hgrepos = []
    issue_num = 26937
    keywords = ['patch']
    message_count = 4.0
    messages = ['264738', '265520', '279744', '282770']
    nosy_count = 4.0
    nosy_names = ['lars.gustaebel', 'xdegaye', 'python-dev', 'Alex.Willmer']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue26937'
    versions = ['Python 3.6', 'Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 3, 2016

    test_tarfile fails on an android emulator running an x86 system image at API level 21.

    ====================================================================== [0/9481]
    FAIL: test_extract_with_numeric_owner (test.test_tarfile.NumericOwnerTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/unittest/mock.py", line 1175, in patched
        return func(*args, **keywargs)
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_tarfile.py", line 2483, in test_extract_
    with_numeric_owner
        any_order=True)
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/unittest/mock.py", line 856, in assert_has_calls
        ) from cause
    AssertionError: (call('/data/local/tmp/test_python_2938/@test_2938_tmp-tardir/numeric-owner-testfile
    ', 99, 98), call('/data/local/tmp/test_python_2938/@test_2938_tmp-tardir/dir/numeric-owner-testfile'
    , 88, 87)) not all found in call list

    ======================================================================
    FAIL: test_extractall_with_numeric_owner (test.test_tarfile.NumericOwnerTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/unittest/mock.py", line 1175, in patched
        return func(*args, **keywargs)
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_tarfile.py", line 2503, in test_extracta
    ll_with_numeric_owner
        any_order=True)
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/unittest/mock.py", line 856, in assert_has_calls
        ) from cause
    AssertionError: (call('/data/local/tmp/test_python_2938/@test_2938_tmp-tardir/numeric-owner-testfile
    ', 99, 98), call('/data/local/tmp/test_python_2938/@test_2938_tmp-tardir/dir', 77, 76), call('/data/
    local/tmp/test_python_2938/@test_2938_tmp-tardir/dir/numeric-owner-testfile', 88, 87)) not all found
     in call list

    Ran 426 tests in 5.549s

    FAILED (failures=2, skipped=80)
    test test_tarfile failed
    1 test failed:
    test_tarfile
    Total duration: 0:00:06

    @xdegaye xdegaye mannequin added build The build process and cross-build stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 3, 2016
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 14, 2016

    On the android-21-x86 emulator:

    >>> import grp
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: dlopen failed: cannot locate symbol "setgrent" referenced by "grp.cpython-36m-i386-linux-gnu.so"...

    The attached patch fixes the tarfile module to handle the case where the pwd module can be imported and the grp module cannot. With this fix test_tarfile runs without any failure.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Oct 30, 2016

    The chown() method of the tarfile.TarFile class does not attempt to do a chown when pwd is None, even when numeric_owner is True, and although an attempt is made to fall back to tarinfo.gid when getgrnam() fails, or to tarinfo.uid when getgrnam() fails, nothing is done if only one of the grp or pwd modules fails on import.

    This new patch is similar to the previous one and is more explicit.

    @xdegaye xdegaye mannequin added 3.7 (EOL) end of life and removed build The build process and cross-build labels Oct 30, 2016
    @xdegaye xdegaye mannequin changed the title android: test_tarfile fails the chown() method of the tarfile.TarFile class fails on Android Oct 30, 2016
    @xdegaye xdegaye mannequin self-assigned this Oct 30, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 9, 2016

    New changeset e4e7bc640865 by Xavier de Gaye in branch '3.6':
    Issue bpo-26937: The chown() method of the tarfile.TarFile class does not fail now
    https://hg.python.org/cpython/rev/e4e7bc640865

    New changeset da510d1aa683 by Xavier de Gaye in branch 'default':
    Issue bpo-26937: Merge 3.6.
    https://hg.python.org/cpython/rev/da510d1aa683

    @xdegaye xdegaye mannequin closed this as completed Dec 9, 2016
    @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 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants