Title: shutil.make_archive (xxx, tar, root_dir) is adding './' entry to archive which is wrong
Type: Stage: patch review
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: HFM, Jeffrey.Kintscher, Oskar Persson, alanmcintyre, bialix, python-dev, serhiy.storchaka, tarek, twouters
Priority: normal Keywords: patch

Created on 2019-02-11 12:40 by HFM, last changed 2019-06-02 02:45 by Jeffrey.Kintscher.

File name Uploaded Description Edit
tarfile_test.tar HFM, 2019-02-11 12:40 reproduce the problem
Pull Requests
URL Status Linked Edit
PR 13738 open Jeffrey.Kintscher, 2019-06-02 02:40
Messages (2)
msg335211 - (view) Author: HFM (HFM) Date: 2019-02-11 12:40
Running shutil.make_archive('a', 'tar', 'subdir') is created wrong and not really needed entry "./" which is visible in tarfile.Tarfile.list():

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

I have tested and found this issue in the following versions of python:
2.7.15rc1  FOUND
3.6.7      FOUND
3.7.1      FOUND

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

Similar issue has been fixed for 'zip' ( but exists for 'tar' archives.
msg344254 - (view) Author: Jeffrey Kintscher (Jeffrey.Kintscher) * Date: 2019-06-02 02:45
I submitted a pull request that excludes '.' directory entries when adding directories to a tar archive.
Date User Action Args
2019-06-02 02:45:22Jeffrey.Kintschersetmessages: + msg344254
2019-06-02 02:40:43Jeffrey.Kintschersetkeywords: + patch
stage: patch review
pull_requests: + pull_request13621
2019-05-31 09:23:10Jeffrey.Kintschersetnosy: + Jeffrey.Kintscher
2019-02-11 14:03:41Oskar Perssonsetnosy: + Oskar Persson
2019-02-11 12:40:46HFMcreate