aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-08-20 10:18:16 -0400
committerMike Frysinger <vapier@gentoo.org>2015-08-20 10:18:16 -0400
commit5e8a1d49de38f60c3ffd8a9122636b463ec9e438 (patch)
tree60d4977dbf3d105e942cdb83cc79203fd94b1c3d /lddtree.py
parentavoid using \n with warn macros (diff)
downloadpax-utils-5e8a1d49de38f60c3ffd8a9122636b463ec9e438.tar.gz
pax-utils-5e8a1d49de38f60c3ffd8a9122636b463ec9e438.tar.bz2
pax-utils-5e8a1d49de38f60c3ffd8a9122636b463ec9e438.zip
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@debian.org>
Diffstat (limited to 'lddtree.py')
-rwxr-xr-xlddtree.py6
1 files changed, 5 insertions, 1 deletions
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)]