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 doesn't archive empty directories #69170

Closed
EugeneK mannequin opened this issue Sep 2, 2015 · 5 comments
Closed

shutil.make_archive doesn't archive empty directories #69170

EugeneK mannequin opened this issue Sep 2, 2015 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@EugeneK
Copy link
Mannequin

EugeneK mannequin commented Sep 2, 2015

BPO 24982
Nosy @tarekziade, @merwok, @bitdancer, @serhiy-storchaka
Files
  • make_archive_zip_dirs.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 2015-09-17.09:32:38.631>
    created_at = <Date 2015-09-02.00:56:16.919>
    labels = ['type-bug', 'library']
    title = "shutil.make_archive doesn't archive empty directories"
    updated_at = <Date 2015-09-17.09:32:38.630>
    user = 'https://bugs.python.org/eugenek'

    bugs.python.org fields:

    activity = <Date 2015-09-17.09:32:38.630>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-09-17.09:32:38.631>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2015-09-02.00:56:16.919>
    creator = 'eugenek'
    dependencies = []
    files = ['40381']
    hgrepos = []
    issue_num = 24982
    keywords = ['patch']
    message_count = 5.0
    messages = ['249522', '249542', '249997', '250021', '250146']
    nosy_count = 6.0
    nosy_names = ['tarek', 'eric.araujo', 'r.david.murray', 'python-dev', 'serhiy.storchaka', 'eugenek']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue24982'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5', 'Python 3.6']

    @EugeneK
    Copy link
    Mannequin Author

    EugeneK mannequin commented Sep 2, 2015

    Zip file is sometimes known to only contain files and the paths to them, but it can also have have empty folders, they are zero length files with a flag set.

    make_archive just ignores empty directories, I propose that there should either be a flag, or it should include empty directories by default.

    @EugeneK EugeneK mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Sep 2, 2015
    @bitdancer
    Copy link
    Member

    See also bpo-22219. I think we should fix this in shutil as well.

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 6, 2015
    @serhiy-storchaka
    Copy link
    Member

    Here is a patch. Should this be considered as a bug fix rather than new feature?

    @bitdancer
    Copy link
    Member

    I think it could be considered a bug fix, given that other archive programs, including zipfile itself, act in this way, and it is relatively unlikely that anyone is *depending* on make_archive not including empty directories (ie: that it would break their code if these directories were included).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 8, 2015

    New changeset 705ec4145f06 by Serhiy Storchaka in branch '2.7':
    Issue bpo-24982: shutil.make_archive() with the "zip" format now adds entries
    https://hg.python.org/cpython/rev/705ec4145f06

    New changeset 19216f5f6ee0 by Serhiy Storchaka in branch '3.4':
    Issue bpo-24982: shutil.make_archive() with the "zip" format now adds entries
    https://hg.python.org/cpython/rev/19216f5f6ee0

    New changeset 142a5027ab3e by Serhiy Storchaka in branch '3.5':
    Issue bpo-24982: shutil.make_archive() with the "zip" format now adds entries
    https://hg.python.org/cpython/rev/142a5027ab3e

    New changeset 6907716e7ccb by Serhiy Storchaka in branch 'default':
    Issue bpo-24982: shutil.make_archive() with the "zip" format now adds entries
    https://hg.python.org/cpython/rev/6907716e7ccb

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants