commit: 5e8a1d49de38f60c3ffd8a9122636b463ec9e438
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 20 14:18:16 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Aug 20 14:18:16 2015 +0000
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=5e8a1d49
lddtree.py: fix glob handling w/ld.so.conf
glibc's glob handling of ld.so.conf includes ends up sorting the results
(since the glob func sorts by default), but python does not. We need to
sort things explicitly ourselves.
Reported-by: Tomasz Buchert <tomasz <AT> debian.org>
lddtree.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lddtree.py b/lddtree.py
index 9330295..100f475 100755
--- a/lddtree.py
+++ b/lddtree.py
@@ -233,7 +233,11 @@ def ParseLdSoConf(ldso_conf, root='/', debug=False,
_first=True):
else:
line = os.path.dirname(ldso_conf) + '/' + line
dbg(debug, '%s glob: %s' % (dbg_pfx, line))
- for path in glob.glob(line):
+ # ldconfig in glibc uses glob() which returns entries sorted
according
+ # to LC_COLLATE. Further, ldconfig does not reset that but respects
+ # the active env settings (which might be a mistake). Python does
not
+ # sort its results by default though, so do it ourselves.
+ for path in sorted(glob.glob(line)):
paths += ParseLdSoConf(path, root=root, debug=debug, _first=False)
else:
paths += [normpath(root + line)]