File 0001-glob-sort-the-resulting-list.patch of Package python3

From 0d1d08adaf15633290002ae81b895a5f9c3700b5 Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Tue, 23 May 2017 15:33:54 +0200
Subject: [PATCH] glob: sort the resulting list

because POSIX readdir does not guarantee any order
glob often gave unexpectedly random results.

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.

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.
---
 Lib/glob.py           | 2 +-
 Lib/test/test_glob.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Lib/glob.py b/Lib/glob.py
index 002cd92019..40d2afd041 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -17,7 +17,7 @@ def glob(pathname, *, recursive=False):
     If recursive is true, the pattern '**' will match any files and
     zero or more directories and subdirectories.
     """
-    return list(iglob(pathname, recursive=recursive))
+    return sorted(list(iglob(pathname, recursive=recursive)))
 
 def iglob(pathname, *, recursive=False):
     """Return an iterator which yields the paths matching a pathname pattern.
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index dce64f9fcb..c1c70974af 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -49,10 +49,10 @@ class GlobTests(unittest.TestCase):
             pattern = os.path.join(*parts)
         p = os.path.join(self.tempdir, pattern)
         res = glob.glob(p, **kwargs)
-        self.assertEqual(list(glob.iglob(p, **kwargs)), res)
+        self.assertEqual(sorted(list(glob.iglob(p, **kwargs))), res)
         bres = [os.fsencode(x) for x in res]
         self.assertEqual(glob.glob(os.fsencode(p), **kwargs), bres)
-        self.assertEqual(list(glob.iglob(os.fsencode(p), **kwargs)), bres)
+        self.assertEqual(sorted(list(glob.iglob(os.fsencode(p), **kwargs))), bres)
         return res
 
     def assertSequencesEqual_noorder(self, l1, l2):
-- 
2.12.0