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.py longnames are truncated in getnames() #40919

Closed
gustaebel mannequin opened this issue Sep 16, 2004 · 2 comments
Closed

tarfile.py longnames are truncated in getnames() #40919

gustaebel mannequin opened this issue Sep 16, 2004 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@gustaebel
Copy link
Mannequin

gustaebel mannequin commented Sep 16, 2004

BPO 1029061
Nosy @loewis, @gustaebel
Files
  • membernames.patch: patch against Lib/tarfile.py
  • 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 2004-09-18.09:09:31.000>
    created_at = <Date 2004-09-16.08:44:18.000>
    labels = ['library']
    title = 'tarfile.py longnames are truncated in getnames()'
    updated_at = <Date 2004-09-18.09:09:31.000>
    user = 'https://github.com/gustaebel'

    bugs.python.org fields:

    activity = <Date 2004-09-18.09:09:31.000>
    actor = 'loewis'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2004-09-16.08:44:18.000>
    creator = 'lars.gustaebel'
    dependencies = []
    files = ['6254']
    hgrepos = []
    issue_num = 1029061
    keywords = ['patch']
    message_count = 2.0
    messages = ['46908', '46909']
    nosy_count = 2.0
    nosy_names = ['loewis', 'lars.gustaebel']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1029061'
    versions = ['Python 2.4']

    @gustaebel
    Copy link
    Mannequin Author

    gustaebel mannequin commented Sep 16, 2004

    When a TarFile object reads a tar archive, it scans
    through the headers, converts them into TarInfo objects
    and adds them to the internal data structures:

    self.members.append(tarinfo)
    self.membernames.append(tarinfo.name)

    When a GNU longname member is processed, it is added at
    a point in time when its name attribute has not yet
    been replaced with the longname, so longnames in
    self.membernames are truncated and therefore unusable.

    This problem could have been fixed with a quick/dirty
    hack. But I decided to remove self.membernames
    completely because it is redundant. getnames() which
    was the public interface to it now generates a list
    on-the-fly from the list of members, so it always
    reflects the actual state.

    I encountered another small bug on the way. The docs
    for TarFile.getmember() state: "If a member occurs more
    than once in the archive, its last occurence is assumed
    to be the most up-to-date version."
    It was never implemented like that, so I fixed it, too.

    @gustaebel gustaebel mannequin closed this as completed Sep 16, 2004
    @gustaebel gustaebel mannequin added the stdlib Python modules in the Lib dir label Sep 16, 2004
    @gustaebel gustaebel mannequin closed this as completed Sep 16, 2004
    @gustaebel gustaebel mannequin added the stdlib Python modules in the Lib dir label Sep 16, 2004
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Sep 18, 2004

    Logged In: YES
    user_id=21627

    Thanks for the patch. Applied as

    tarfile.py 1.20
    NEWS 1.1137

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 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