Skip to content

Add ZipInfo.mode property #91356

Open
Open

Description

@dignissimus
BPO 47200
Nosy @Yhg1s, @ethanfurman, @serhiy-storchaka, @dignissimus
PRs
  • gh-91356: Add ZipInfo.mode attribute #32252
  • Files
  • sam_ezeh.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 2022-04-02.12:21:15.631>
    labels = ['type-feature', 'library', '3.11']
    title = 'Add ZipInfo.mode property'
    updated_at = <Date 2022-04-02.21:29:27.246>
    user = 'https://github.com/dignissimus'

    bugs.python.org fields:

    activity = <Date 2022-04-02.21:29:27.246>
    actor = 'ethan.furman'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2022-04-02.12:21:15.631>
    creator = 'sam_ezeh'
    dependencies = []
    files = ['50715']
    hgrepos = []
    issue_num = 47200
    keywords = ['patch']
    message_count = 1.0
    messages = ['416550']
    nosy_count = 5.0
    nosy_names = ['twouters', 'alanmcintyre', 'ethan.furman', 'serhiy.storchaka', 'sam_ezeh']
    pr_nums = ['32252']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue47200'
    versions = ['Python 3.11']

    Activity

    1. dignissimus commented on Apr 2, 2022

      dignissimusmannequin
      MannequinAuthor

      Initially, I was looking at bpo-18262 and saw the following Stack Overflow thread that was linked.

      https://stackoverflow.com/questions/434641/how-do-i-set-permissions-attributes-on-a-file-in-a-zip-file-using-pythons-zip/6297838

      I've attached a patch that gives ZipInfo objects a ZipInfo.mode property getter and setter to get and set the file mode.

      I considered adding ZipFile.chmod but I didn't know how it would work given that archives can contain duplicate files.

      As an aside, I wondered if there's a way to update file attributes inside zip archives without deleting and rewriting them and if not, whether it would be worthwhile to add one.

    2. added
      3.11
      stdlib
      type-feature
      on Apr 2, 2022
    3. transferred this issue fromon Apr 10, 2022
    4. gpshead commented on Dec 21, 2023

      @gpshead
      Member

      While the supplied patch adding a property for mode makes sense, I think it'd need to go a little further and handle things like the 0o40000 bit for Directory and whatever other potential bits zip files are able to represent. not just the base 9-bit posix mode values.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11stdlibtype-feature

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions