[issue24465] Make tarfile have deterministic sorting

2015-06-22 Thread Sam Thursfield
Sam Thursfield added the comment: Here's a patch which does the same thing but only for shutil.make_archive(). Note that the final output will still be non-deterministic if you use format=gztar because time.time() and the base_name argument get added to the gzip header. Might be nice t

[issue24465] Make tarfile have deterministic sorting

2015-06-19 Thread Sam Thursfield
Sam Thursfield added the comment: Having tested, the problem I described above doesn't happen with this patch. It's a mistake in some other code I wrote which is following symlinks when it should not do. -- ___ Python trac

[issue24465] Make tarfile have deterministic sorting

2015-06-19 Thread Sam Thursfield
Sam Thursfield added the comment: I've discovered that this patch introduces a nasty failure case! If you have a relative symlink pointing to a directory that's alphabetically sorted after the symlink, and files inside the symlink, 'tar -x' won't be able to create

[issue24465] Make tarfile have deterministic sorting

2015-06-18 Thread Sam Thursfield
Sam Thursfield added the comment: Thanks for the comments! Would you be happy for the patch to be merged if it was implemented by modifying shutil.make_archive() instead? I will rework it if so. -- ___ Python tracker <http://bugs.python.

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

2015-06-18 Thread Sam Thursfield
Changes by Sam Thursfield : -- keywords: +patch Added file: http://bugs.python.org/file39728/tarfile-stable-ordering.patch ___ Python tracker <http://bugs.python.org/issue24

[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

[issue16477] tarfile fails to close file handles in case of exception

2012-11-15 Thread Sam Thursfield
Sam Thursfield added the comment: sorry, replace 'open' with 'bltn_open' in the above comment - no need to change it. -- ___ Python tracker <http://bug

[issue16477] tarfile fails to close file handles in case of exception

2012-11-15 Thread Sam Thursfield
New submission from Sam Thursfield: Exceptions such as disk full during extraction cause tarfile to leak file handles. Besides being messy, it causes real problems if, for example, the target file is on a mount that should be unmounted before the program exits - in this case, the unmount will