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

shutil.make_archive (xxx, zip, root_dir) is adding './' entry to archive which is wrong #72674

Closed
bialix mannequin opened this issue Oct 20, 2016 · 4 comments
Closed
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@bialix
Copy link
Mannequin

bialix mannequin commented Oct 20, 2016

BPO 28488
Nosy @Yhg1s, @tarekziade, @serhiy-storchaka
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • make-archive-test.py: reproduce the problem
  • shutil_make_archive_zip_curdir.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 = <Date 2016-10-23.16:16:23.824>
    created_at = <Date 2016-10-20.13:07:50.407>
    labels = ['3.7', 'type-bug', 'library']
    title = "shutil.make_archive (xxx, zip, root_dir) is adding './' entry to archive which is wrong"
    updated_at = <Date 2019-02-08.09:35:14.035>
    user = 'https://bugs.python.org/bialix'

    bugs.python.org fields:

    activity = <Date 2019-02-08.09:35:14.035>
    actor = 'HFM'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-10-23.16:16:23.824>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2016-10-20.13:07:50.407>
    creator = 'bialix'
    dependencies = []
    files = ['45151', '45153']
    hgrepos = []
    issue_num = 28488
    keywords = ['patch']
    message_count = 4.0
    messages = ['279031', '279042', '279258', '335067']
    nosy_count = 7.0
    nosy_names = ['twouters', 'alanmcintyre', 'bialix', 'tarek', 'python-dev', 'serhiy.storchaka', 'HFM']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue28488'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @bialix
    Copy link
    Mannequin Author

    bialix mannequin commented Oct 20, 2016

    Running shutil.make_archive('a', 'zip', 'subdir') is created wrong and not really needed entry "./" which is visible in zipfile.ZipFile.namelist():

    ['./', 'foo/', 'hello.txt', 'foo/bar.txt']

    This "./" affects some (windows) unzip tools which produces warnings/errors about this incorrect entry.

    This error present in Python 2.7.11-12 and Python 3.4.4 (those I have installed right now). But Python 3.3.5 does not have it, maybe because it omits entries for directories at all.

    I've attached a simple script which illustrates problem. Tested on Windows with mentioned python versions.

    Can't reproduce on Centos 7.2 with Python 3.4.3 and 2.7.5.

    I suppose it could be realted to the change I spot in latest 2.7 changelog:

    • Issue bpo-24982: shutil.make_archive() with the "zip" format now adds entries
      for directories (including empty directories) in ZIP file.

    @bialix bialix mannequin added the stdlib Python modules in the Lib dir label Oct 20, 2016
    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Oct 20, 2016
    @serhiy-storchaka
    Copy link
    Member

    Thank you for your report Alexander. Yes, this regression was introduced in bpo-24982. Proposed patch fixes it.

    @serhiy-storchaka serhiy-storchaka self-assigned this Oct 20, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 23, 2016

    New changeset 847537b7924c by Serhiy Storchaka in branch '2.7':
    Issue bpo-28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
    https://hg.python.org/cpython/rev/847537b7924c

    New changeset d4fce66ebe01 by Serhiy Storchaka in branch '3.5':
    Issue bpo-28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
    https://hg.python.org/cpython/rev/d4fce66ebe01

    New changeset e93149fee04d by Serhiy Storchaka in branch '3.6':
    Issue bpo-28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
    https://hg.python.org/cpython/rev/e93149fee04d

    New changeset 72da53d3074b by Serhiy Storchaka in branch 'default':
    Issue bpo-28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
    https://hg.python.org/cpython/rev/72da53d3074b

    @HFM
    Copy link
    Mannequin

    HFM mannequin commented Feb 8, 2019

    There is a similar bug/issue for 'tar' archives.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant