[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 to add an

[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 tracker

[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 those files because the symli

[issue24465] Make tarfile have deterministic sorting

2015-06-19 Thread Lars Gustäbel
Lars Gustäbel added the comment: The patch would change behaviour for all tarfile users by the back door, that's why I am a little reluctant. And if the same can be achieved by a reasonably simple change to shutil I think it's just as well. -- ___ P

[issue24465] Make tarfile have deterministic sorting

2015-06-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't see any downside for this simple patch and think there is some merit for wanting a reproducible archive. -- nosy: +rhettinger ___ Python tracker ___

[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

[issue24465] Make tarfile have deterministic sorting

2015-06-18 Thread Lars Gustäbel
Lars Gustäbel added the comment: You don't need to patch the tarfile module. You could use os.walk() in shutil._make_tarball() and add each file with TarFile.add(recursive=False). -- nosy: +lars.gustaebel ___ Python tracker

[issue24465] Make tarfile have deterministic sorting

2015-06-18 Thread R. David Murray
R. David Murray added the comment: This would go beyond what the tar command itself does. I'm not sure we want to do that, as we are pretty much modeling our behavior on tar. However, that doesn't automatically mean we can't do it. We'll see what other people think. Personally I'm -0. I'