summaryrefslogtreecommitdiff
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <githubbmw@lsmod.de>2018-01-31 11:17:10 +0100
committerVictor Stinner <victor.stinner@gmail.com>2018-01-31 11:17:10 +0100
commit84521047e413d7d1150aaa1c333580b683b3f4b1 (patch)
tree1aae1c2f5a8b27562c9ea1fa153769066b1be5af /Lib/tarfile.py
parent8d83e4ba7823827bcbc119db887004d5c3a63dc6 (diff)
downloadcpython-git-84521047e413d7d1150aaa1c333580b683b3f4b1.tar.gz
bpo-30693: zip+tarfile: sort directory listing (#2263)
tarfile and zipfile now sort directory listing to generate tar and zip archives in a more reproducible way. See also https://reproducible-builds.org/docs/stable-inputs/ on that topic.
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-xLib/tarfile.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 0b8d31f85c..a24ee42abf 100755
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -1943,7 +1943,7 @@ class TarFile(object):
elif tarinfo.isdir():
self.addfile(tarinfo)
if recursive:
- for f in os.listdir(name):
+ for f in sorted(os.listdir(name)):
self.add(os.path.join(name, f), os.path.join(arcname, f),
recursive, filter=filter)