| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
| |
Largely this is just single quotes -> double quotes.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
| |
pylint warns about redefining |lib| here, and it's right -- the code
is a little hard to follow because of it. So give it a diff name.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
| |
No need to create a list to past to join when we can pass a generator.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
| |
These are a bit more readable than % formatting.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
Add logging inside parseELF to print the bad file if the parser
fails with ELFParseError.
Bug: https://issuetracker.google.com/issues/203821449
Signed-off-by: Manoj Gupta <manojgupta@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
| |
Should be no functional change.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow explicitly ignoring missing files.
$ lddtree --root=/build/$BOARD --copy-to-tree=. --copy-non-elfs /sbin/lvm /sbin/lvmdump
lddtree: warning: /build/brya/sbin/lvm: did not match any paths
$ echo $?
1
lddtree --root=/build/$BOARD --copy-to-tree=. --copy-non-elfs --skip-missing /sbin/lvm /sbin/lvmdump
lddtree: warning: /build/brya/sbin/lvm: did not match any paths
$ echo $?
0
Signed-off-by: Jae Hoon Kim <kimjae@chromium.org>
Signed-off-by: Mike Frysinger <vapier@chromiium.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
| |
This is important because the path in this func reflects where the
interpreter is going to be living, not where it's being copied from.
These are often the same paths (relatively speaking), but when we're
copying from a cross-compiler sysroot, or when using --libdir so the
target paths are rewritten, the interp path probably does not line
up with whatever happens to live in the active rootfs.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
| |
Rather than rely on ambient environmental settings (the cwd), allow
users to override the cwd explicitly when processing paths.
Bug: https://bugs.gentoo.org/653586
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
Tweak the ldpath logic to handle all relative paths relative to the
cwd instead of the root. Such ELFs are uncommon and weird, but not
invalid, so might as well.
Bug: https://bugs.gentoo.org/653586
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
| |
Bug: https://bugs.gentoo.org/653586
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
Newer glibc has a --argv0 option in current releases to explicitly
set argv[0]. This is useful for the generated shell wrappers as we
need to rename it (with an .elf suffix) and that can either confuse
the output or break tools that inspect their argv[0] strictly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Easy way to reproduce is to copy a cross-compile ELF like:
$ ./lddtree.py --copy-to-tree $PWD/foo /usr/share/qemu/s390-ccw.img
lddtree.py: warning: /usr/share/qemu/s390-ccw.img: [Errno 2] No such file or directory: '/lib/ld64.so.1'
We have checks for missing libs already, but interps are full paths
and thus bypass the resolution logic.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
Adjust our line length to be 100 cols. This matches what the code has
largely been using already, and it fits better with modern systems.
People can still write to 80 cols as makes sense, but we'll consider
that a soft limit with 100 cols as the upper hard limit.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
| |
This aligns with the latest Google/PEP standards.
This doesn't add any pylint warnings as we've been disabling long
lines in here for a long time. We don't do any other reformatting
to try and cut down on git log/diff noise.
Looking at this with --word-diff=color shows only whitespace changes.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
| |
Closes: https://github.com/gentoo/pax-utils/pull/4
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Put ldso interpreter library path at end of libpaths search.
It is supposed to be a final fallback path in case library
search was incomplete.
As a side effect, it currently mitigates the incorrect
libbfd being loaded for aarch64 standalone toolchain.
Bug: https://crbug.com/917193
Reviewed-on: https://crrev.com/c/1920643
Signed-off-by: Manoj Gupta <manojgupta@chromium.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
| |
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
| |
This allows running testsuite as-is on prefix.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
os.errno interface is removed [1], thus should not be used. In fact, it
is not used in other places of lddtree.py, so fix this one too, because
it breaks --copy-to-tree on systems with Python 3.7.
[1] https://bugs.python.org/issue33666
Bug: https://bugs.gentoo.org/671522
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
|
|
| |
This keeps the main func a bit cleaner.
|
|
|
|
| |
Fix up some lddtree logic at the same time so it's warning free.
|
|
|
|
|
|
|
| |
Section names now get returned as strings rather than bytes. See
108eaea9 upstream.
Bug: https://bugs.gentoo.org/599082
|
|
|
|
|
|
| |
Make sure that the wrapped binaries don't use the host's ld.so.cache.
This probably shouldn't show up since we're using --library-path, but
in case that doesn't stop things, explicitly disable the search.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a top level exception handler for catching ELF errors, but if we
hit a problem with a dependency, we end up diagnosing it as a problem in
the first ELF. e.g. If "foo" is linked against "libc.so", and "libc.so"
is a linker script, when we try to read the libc.so ELF, it fails, and
we end up saying:
lddtree: warning: foo: Magic number does not match
This makes no sense because "foo" is a proper ELF with the right magic,
and we end up halting the whole parsing process. Now we show:
lddtree: warning: /usr/lib/libc.so: Magic number does not match
foo (interpreter => /some/interp)
libc.so => None
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the ELF we're showing is linked directly against the ELF which is used
as the ELF interp (i.e. the ldso), make sure we don't list it twice.
We want to see it "twice" in the pretty form:
$ ./lddtree.py /bin/bash
/bin/bash (interpreter => /lib/ld-linux-armhf.so.3) <= here
libreadline.so.6 => /lib/libreadline.so.6
libncurses.so.5 => /lib/libncurses.so.5
libc.so.6 => /lib/libc.so.6
ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 <= here
But not in the list form (as that is used by scripts):
$ ./lddtree.py -l /bin/bash
/bin/bash
/lib/ld-linux-armhf.so.3 <= only here
/lib/libreadline.so.6
/lib/libncurses.so.5
/lib/libc.so.6
We also reconcile a few differences wrt interp display and the sh/py
implementations.
Reported-by: Tomasz Buchert <tomasz@debian.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On aarch64/s390x, the interp is always placed in /lib/ while the libs are
normally placed in /lib64/. If the interp is a symlink (which it normally
is here), then dereference it to locate the lib paths automatically. This
also fixes up some bad lstrip logic in the /usr path expansion.
We could update lddtree.sh with a similar fix, but it would take more work
as it doesn't have the readlink helper to properly walk symlinks according
to an alternative root. Plus, it already uses strings to try and extract
the paths the ldso was compiled against, and that seems to work in these
cases.
Reported-by: Jakub Čajka <jcajka@redhat.com>
URL: https://bugzilla.redhat.com/1162184
|
| |
|
|
|
|
| |
skip the path
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
SONAMEs are usually symlinks, so we need to manually dereference them to get to the right file, but we want to save the original name so we can copy them to the right place
|
|
|
|
| |
This is needed when given a path which itself is an absolute symlink. If we deref it as-is, we end up poking into / instead of $ROOT.
|
|
|
|
| |
the root before checking if they exist
|
| |
|
| |
|
| |
|
| |
|
| |
|