[rb-general] patching python glob
infinity0 at debian.org
Wed May 24 16:21:00 CEST 2017
Bernhard M. Wiedemann:
> I am thinking to propose to python upstream
> which would make every call of glob.glob deliver (reproducible) sorted
> That would help a large number of existing projects
> to get reproducible builds like
> and also future ones.
> What do you think?
Contrary to what others were assuming, python's glob is *not* implemented in terms of the libc glob. You can verify this by reading the source code:
Python's glob is in fact not sorted, and using sorted() will do a locale-independent sort.
The libc glob is local-dependently sorted and you have to run it with LC_ALL=C.UTF-8 for reproducible results.
So, the patch seems fine to me. Though sorted(list(xx)) is redundant and you can just use sorted(xx) directly even if xx is a generator/iterator.
More information about the rb-general