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 stops expanding with long filenames #44956

Closed
zagy mannequin opened this issue May 16, 2007 · 4 comments
Closed

tarfile stops expanding with long filenames #44956

zagy mannequin opened this issue May 16, 2007 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@zagy
Copy link
Mannequin

zagy mannequin commented May 16, 2007

BPO 1719898
Nosy @gustaebel
Files
  • tarfile.patch: Fix for the 100 char bug.
  • 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/gustaebel'
    closed_at = <Date 2007-05-26.08:08:39.000>
    created_at = <Date 2007-05-16.09:32:20.000>
    labels = ['library']
    title = 'tarfile stops expanding with long filenames'
    updated_at = <Date 2007-05-26.08:08:39.000>
    user = 'https://bugs.python.org/zagy'

    bugs.python.org fields:

    activity = <Date 2007-05-26.08:08:39.000>
    actor = 'lars.gustaebel'
    assignee = 'lars.gustaebel'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2007-05-16.09:32:20.000>
    creator = 'zagy'
    dependencies = []
    files = ['2369']
    hgrepos = []
    issue_num = 1719898
    keywords = []
    message_count = 4.0
    messages = ['32013', '32014', '32015', '32016']
    nosy_count = 2.0
    nosy_names = ['lars.gustaebel', 'zagy']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1719898'
    versions = ['Python 2.4']

    @zagy
    Copy link
    Mannequin Author

    zagy mannequin commented May 16, 2007

    The tarfile module fixes an issue with "Some old tar programs represent a directory as a regular file with a trailing slash.":

        if tarinfo.isreg() and tarinfo.name.endswith("/"):
            tarinfo.type = DIRTYPE

    *After* that the full filename is composed. The chars >100 are stored in "prefix":

        if tarinfo.type != GNUTYPE_SPARSE:
            tarinfo.name normpath(os.path.join(nts(tarinfo.prefix), tarinfo.name))

    So guess what happens if you filename has a / at the 100th character. Right, its considered a directory. Since directories have no data, the next metadata block is read from your file data which fails in various ways.

    Patch attached.

    @zagy zagy mannequin closed this as completed May 16, 2007
    @zagy zagy mannequin assigned gustaebel May 16, 2007
    @zagy zagy mannequin added the stdlib Python modules in the Lib dir label May 16, 2007
    @zagy zagy mannequin closed this as completed May 16, 2007
    @zagy zagy mannequin assigned gustaebel May 16, 2007
    @zagy zagy mannequin added the stdlib Python modules in the Lib dir label May 16, 2007
    @gustaebel
    Copy link
    Mannequin

    gustaebel mannequin commented May 16, 2007

    Did you also test Python 2.5? If this error occurs with that version too (which it should not), please attach a small test tar archive to this tracker item.

    Python 2.4 is no longer maintained, sorry.

    @zagy
    Copy link
    Mannequin Author

    zagy mannequin commented May 25, 2007

    Ok, from looking at the code it should work in Python 2.5. I shipped around the Python 2.4 bug by creating a zip release instead of tar.

    Pity that Python 2.4 is no longer maintained though. I guess we need to bump Zope 3 pretty soon then :)

    @gustaebel
    Copy link
    Mannequin

    gustaebel mannequin commented May 26, 2007

    Okay, I close this bug then.

    @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
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants