Skip to content

ZipInfo.external_attr are not documented #62462

Open

Description

@techtonik
mannequin
BPO 18262
Nosy @Yhg1s, @ronaldoussoren, @serhiy-storchaka, @scrool
Superseder
  • bpo-15795: Zipfile.extractall does not preserve file permissions
  • Files
  • Issue18262_27.patch: python 2.7 documentation patch
  • Issue18262_34_35.patch: python 3.x zipfile documentation 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 = 'https://github.com/serhiy-storchaka'
    closed_at = None
    created_at = <Date 2013-06-19.06:19:22.196>
    labels = ['type-feature', 'library', 'docs']
    title = 'ZipInfo.external_attr are not documented'
    updated_at = <Date 2020-05-17.14:25:40.155>
    user = 'https://bugs.python.org/techtonik'

    bugs.python.org fields:

    activity = <Date 2020-05-17.14:25:40.155>
    actor = 'scrool'
    assignee = 'serhiy.storchaka'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation', 'Library (Lib)']
    creation = <Date 2013-06-19.06:19:22.196>
    creator = 'techtonik'
    dependencies = []
    files = ['34858', '34859']
    hgrepos = []
    issue_num = 18262
    keywords = ['patch']
    message_count = 10.0
    messages = ['191447', '191451', '191456', '191457', '191458', '191488', '216246', '216247', '241314', '369122']
    nosy_count = 8.0
    nosy_names = ['twouters', 'ronaldoussoren', 'alanmcintyre', 'techtonik', 'docs@python', 'serhiy.storchaka', 'Alex.LordThorsen', 'scrool']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = '15795'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue18262'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    Activity

    1. techtonik commented on Jun 19, 2013

      techtonikmannequin
      MannequinAuthor

      zipfile doesn't restore file attributes when extracting. Documentation should at least contain example how to do this manually, because the ony way to do this - through ZipInfo.external_attr is too cryptic.

    2. added
      docs
      on Jun 19, 2013
    3. ronaldoussoren commented on Jun 19, 2013

      @ronaldoussoren
      Contributor

      I'd be +1 on extending the zipfile API in 3.4 (with a documentation update in older releases as suggested by anatoly):

      • Add a method or property to ZipInfo for (un)packing
        the external_attr field

      • Add an keyword argument to Zipfile.extract and Zipfile.extractall that
        toggles restoring file permissions. This should be off by default for
        backward compatibility.

        The code that restores the file permissions should be careful to avoid
        security problems, IMHO it should by default ignore the SUID en SGID
        bits.

    4. added
      stdlib
      type-feature
      on Jun 19, 2013
    5. ronaldoussoren commented on Jun 19, 2013

      @ronaldoussoren
      Contributor

      See also bpo-15795

    6. ronaldoussoren commented on Jun 19, 2013

      @ronaldoussoren
      Contributor

      Closing this as a duplicate of bpo-15795 (which already has a patch)

    7. techtonik commented on Jun 19, 2013

      techtonikmannequin
      MannequinAuthor

      3.4+ feature is not a replacement for proper documentation for 2.7-3.4

    8. AlexLordThorsen commented on Apr 14, 2014

      AlexLordThorsenmannequin
      Mannequin

      Here's a documentation patch for 2.7 that informs the users that Zipfile.extra and Zipfile.extraall don't save permissions and that Zipfile.writestr will use ZipInfo.extra_attr or default to chmod permission set of 0600.

    9. AlexLordThorsen commented on Apr 14, 2014

      AlexLordThorsenmannequin
      Mannequin

      And here's the 3.4 and 3.5 patch

    10. AlexLordThorsen commented on Apr 17, 2015

      AlexLordThorsenmannequin
      Mannequin

      Any follow up on this?

    11. scrool commented on May 17, 2020

      scroolmannequin
      Mannequin

      I'm interested in this documentation enhancement as well.

      Alex, I'm wondering if you could convert your patch to GitHub? [1]

      [1] https://devguide.python.org/pullrequest/#converting-an-existing-patch-from-b-p-o-to-github

    12. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    docsstdlibtype-feature

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions