[issue24465] Make tar files created by shutil.make_archive() have deterministic sorting

2015-06-18 Thread Sam Thursfield

Changes by Sam Thursfield sam.thursfi...@codethink.co.uk:


--
keywords: +patch
Added file: http://bugs.python.org/file39728/tarfile-stable-ordering.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24465
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24465] Make tar files created by shutil.make_archive() have deterministic sorting

2015-06-18 Thread Sam Thursfield

New submission from Sam Thursfield:

I want shutil.make_archive() to produce deterministic output when given 
identical data as inputs.

Right now there are two holes in this. One is that mtimes might not match. This 
can be fixed by the caller. The second is that the order that files in a 
subdirectory get added to the tarfile is not deterministic. This can't be fixed 
by the caller.

Attached is a trivial patch to sort the results of os.listdir() to ensure the 
output tarfile is stable.

This only applies to the 'tar' format.

I've attached my testcase for this, which creates 3 tarfiles in /tmp. When this 
patch is applied, the 3 tarfiles it creates are identical according to 
`sha1sum`. Without this patch, they are all different.

--
components: Library (Lib)
files: tar-reproducible-testcase.py
messages: 245464
nosy: samthursfield
priority: normal
severity: normal
status: open
title: Make tar files created by shutil.make_archive() have deterministic 
sorting
type: enhancement
Added file: http://bugs.python.org/file39727/tar-reproducible-testcase.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24465
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com