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

Fixing tarfile._mode when using gzip via ":gz" #62775

Open
edulix mannequin opened this issue Jul 28, 2013 · 4 comments
Open

Fixing tarfile._mode when using gzip via ":gz" #62775

edulix mannequin opened this issue Jul 28, 2013 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@edulix
Copy link
Mannequin

edulix mannequin commented Jul 28, 2013

BPO 18575
Nosy @jcea, @gustaebel, @serhiy-storchaka
Dependencies
  • bpo-18321: Multivolume support in tarfile module
  • Files
  • gzip.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 = None
    created_at = <Date 2013-07-28.08:35:14.482>
    labels = ['type-bug', 'library']
    title = 'Fixing tarfile._mode when using gzip via ":gz"'
    updated_at = <Date 2013-09-20.19:24:34.339>
    user = 'https://bugs.python.org/edulix'

    bugs.python.org fields:

    activity = <Date 2013-09-20.19:24:34.339>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2013-07-28.08:35:14.482>
    creator = 'edulix'
    dependencies = ['18321']
    files = ['31062']
    hgrepos = []
    issue_num = 18575
    keywords = ['patch']
    message_count = 3.0
    messages = ['193812', '193813', '198162']
    nosy_count = 4.0
    nosy_names = ['jcea', 'lars.gustaebel', 'serhiy.storchaka', 'edulix']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18575'
    versions = ['Python 3.4']

    @edulix
    Copy link
    Mannequin Author

    edulix mannequin commented Jul 28, 2013

    A TarFile object constructor accepts a fileobj argument. When this argument is set and it has a "mode" property, tarfile._mode is blindly copied from there. Otherwise, mode is set using the mode argument in the constructor.

    This usually works, but in the case where fileobj is a gzip.GzipFile, the "mode" property is not a string like "rb" or "wb" but an integer, which is not expected in TarFile.

    This has not been noticed before probably because the TarFile._mode property is usually unused internally, but in my case it's a problem when using it together with tarfile multivolume mode provided in issue bpo-18321.

    @edulix edulix mannequin added the stdlib Python modules in the Lib dir label Jul 28, 2013
    @edulix
    Copy link
    Mannequin Author

    edulix mannequin commented Jul 28, 2013

    Fixing gzip.patch, it was using basestring (python2) instead of str

    @serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Jul 28, 2013
    @serhiy-storchaka
    Copy link
    Member

    Perhaps we should rather change GzipFile.mode to be a string?

    @serhiy-storchaka
    Copy link
    Member

    It is now a string since #115961.

    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 type-bug An unexpected behavior, bug, or error
    Projects
    Status: No status
    Status: No status
    Development

    No branches or pull requests

    1 participant