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

TarFile.getmember cannot work on tar sourced directory over 100 characters #91387

Open
cfernald mannequin opened this issue Apr 5, 2022 · 3 comments
Open

TarFile.getmember cannot work on tar sourced directory over 100 characters #91387

cfernald mannequin opened this issue Apr 5, 2022 · 3 comments
Labels
3.9 3.10 3.11 stdlib type-bug

Comments

@cfernald
Copy link
Mannequin

@cfernald cfernald mannequin commented Apr 5, 2022

BPO 47231
Nosy @bitdancer, @ethanfurman, @serhiy-storchaka, @akulakov, @cfernald
Files
  • tarfile_repro.py: Example of tarfile bug using arm gcc compiler tarfile
  • 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 = None
    created_at = <Date 2022-04-05.18:15:20.584>
    labels = ['type-bug', 'library', '3.9', '3.10', '3.11']
    title = 'TarFile.getmember cannot work on tar sourced directory over 100 characters'
    updated_at = <Date 2022-04-05.22:06:10.413>
    user = 'https://github.com/cfernald'

    bugs.python.org fields:

    activity = <Date 2022-04-05.22:06:10.413>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2022-04-05.18:15:20.584>
    creator = 'cfernald'
    dependencies = []
    files = ['50721']
    hgrepos = []
    issue_num = 47231
    keywords = []
    message_count = 2.0
    messages = ['416793', '416796']
    nosy_count = 5.0
    nosy_names = ['r.david.murray', 'ethan.furman', 'serhiy.storchaka', 'andrei.avk', 'cfernald']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue47231'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @cfernald
    Copy link
    Mannequin Author

    @cfernald cfernald mannequin commented Apr 5, 2022

    A fix was made to unify handling of the trailing slash in TarFile.getmember related to https://bugs.python.org/issue21987. This change fixed the <100 character case, but made it so directories over 100 character which come from a tar file can no longer be accessed through getmember, even if returned from getnames. This appears to be because internal to tarfile, member names still include the trailing slash on directories over 100 characters but getmember will always remove the trailing slash from the provided name so the comparison will always fail.

    A simple example of this is as follows using 3.10.4.

    1. Download: https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz

    2. place attached python script in same directory

    3. run on 3.8.2 -> fails to get stripped version of path (line 16)

    4. run on 3.10.4 -> fails to get even unstripped version (line 12 & 16)

    @cfernald cfernald mannequin added 3.9 3.10 3.11 stdlib type-bug labels Apr 5, 2022
    @ethanfurman
    Copy link
    Member

    @ethanfurman ethanfurman commented Apr 5, 2022

    Nosied others from bpo-21987.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @cfernald
    Copy link

    @cfernald cfernald commented Apr 11, 2022

    Introduced Pull request 32423 to resolve this issue.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 3.10 3.11 stdlib type-bug
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants