On 28/07/15 11:53, Arturo Borrero Gonzalez wrote:
> On 27 July 2015 at 16:44, Tomasz Buchert <tom...@debian.org> wrote:
> > On 24/07/15 14:49, Tomasz Buchert wrote:
> >> [...]
> >>
> >>   * you should confirm that python-pyelftools ignore dynamic linker
> >>     configuration (I suspect this is true); it would be good to
> >>     extract a minimal Python program using pyelftools that shows this
> >>
> >
> > I take it back, maybe pyelftools do not parse ld.so.conf, but lddtree.py
> > in pax-utils *does* parse it. It must be something else then.
> >
>
> Ok,
>
> Could you please point me to the upstream bug tracker?
>
> --
> Arturo Borrero González
>

I'm not sure there is such a thing, but the upstream authors have been
very reponsive. Btw, I may have found the problem, I attach a patch,
which has been sent to upstream authors. It passes all tests, but may
break something that I'm ignorant about.

Tomasz
From d2d08a5c7e5b82f426d16a5d241fb2780bff884a Mon Sep 17 00:00:00 2001
From: Tomasz Buchert <tom...@debian.org>
Date: Tue, 28 Jul 2015 13:09:27 +0200
Subject: [PATCH] Don't add interpreter into libs cache.

There is not guarantee that the path of interpreter is in ld.so.conf
paths, so it is incorrect to prepopulate it in the libs cache.

Another problem solved here is the order of files included via globs in
/etc/ld.so.conf. These files should be ordered alphabetically (see
glob(3) used by ldconfig), but it was not the case in lddtree.py.
---
 lddtree.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lddtree.py b/lddtree.py
index 9330295..d76bee4 100755
--- a/lddtree.py
+++ b/lddtree.py
@@ -233,7 +233,7 @@ 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):
+          for path in sorted(glob.glob(line)):
             paths += ParseLdSoConf(path, root=root, debug=debug, _first=False)
         else:
           paths += [normpath(root + line)]
@@ -282,7 +282,6 @@ def LoadLdpaths(root='/', prefix='', debug=False):
   # Load up /etc/ld.so.conf.
   ldpaths['conf'] = ParseLdSoConf(root + prefix + '/etc/ld.so.conf', root=root,
                                   debug=debug)
-
   return ldpaths
 
 
@@ -402,11 +401,12 @@ def ParseELF(path, root='/', prefix='', ldpaths={'conf':[], 'env':[], 'interp':[
         dbg(debug, '  interp           =', interp)
         ret['interp'] = normpath(root + interp)
         real_interp = readlink(ret['interp'], root, prefixed=True)
-        ret['libs'][os.path.basename(interp)] = {
-            'path': ret['interp'],
-            'realpath': real_interp,
-            'needed': [],
-        }
+
+        # ret['libs'][os.path.basename(interp)] = {
+        #     'path': ret['interp'],
+        #     'realpath': real_interp,
+        #     'needed': [],
+        # }
         # XXX: Could read it and scan for /lib paths.
         # If the interp is a symlink, lets follow it on the assumption that it
         # is in this path purely for ABI reasons, and the distro is using a
-- 
2.4.6

Attachment: signature.asc
Description: Digital signature

Reply via email to