bpo-30461: glob: sort the resulting list by bmwiedemann · Pull Request #1794 · python/cpython
because POSIX readdir does not guarantee any order
glob often gave unexpectedly random results.
This change makes it behave similar to POSIX glob(3).
Some background:
for openSUSE Linux we build packages in the Open Build Service (OBS)
which tracks dependencies, so when e.g. a new glibc is submitted,
all packages depending on glibc are rebuilt
and if those depending binaries changed,
the new version is pushed to the mirrors.
Many python modules build their .so files from a glob.glob("*.cpp")
The old glob behaviour would often lead to the linker
randomly ordering functions in resulting object files,
thus we were not able to auto-detect
that the package did not actually change
which wastes bandwidth of distribution mirrors and users.
See also https://reproducible-builds.org/ on that topic.
This change should not break existing software
because there were no guarantees on ordering of glob results.
Measurements with 'perf' show the new code to be 4ms / 1.07x slower
(for /usr/*/* with 9854 files)
The alternative would be to patch each package individually
but that would be quite some effort and not be as nice to use
as can be seen in
https://www.riverbankcomputing.com/pipermail/pyqt/2017-May/039214.html