Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow printing of generatedExcludelist #46

Closed
fzakaria opened this issue Dec 7, 2021 · 2 comments
Closed

Allow printing of generatedExcludelist #46

fzakaria opened this issue Dec 7, 2021 · 2 comments

Comments

@fzakaria
Copy link
Contributor

fzakaria commented Dec 7, 2021

First off, love the tool and it's simplicity.

I am trying to compare the tool to ldd and I find the secret exclusion of "generatedExcludelist" to be confusing.
There does not seem to be an optional to also include them by default.

libtree ruby -v
ruby
├── libruby-2.7.4.so.2.7 [runpath]
│   ├── libz.so.1 (skipped) [runpath]
│   ├── libpthread.so.0 (skipped) [runpath]
│   ├── librt.so.1 (skipped) [runpath]
│   ├── libdl.so.2 (skipped) [runpath]
│   ├── libcrypt.so.1 [runpath]
│   │   └── libc.so.6 (skipped) [ld.so.conf]
│   ├── libm.so.6 (skipped) [runpath]
│   ├── libc.so.6 (skipped) [runpath]
│   └── ld-linux-x86-64.so.2 (skipped) [runpath]
├── libz.so.1 (skipped) [runpath]
├── libpthread.so.0 (skipped) [runpath]
├── librt.so.1 (skipped) [runpath]
├── libdl.so.2 (skipped) [runpath]
├── libcrypt.so.1 (collapsed) [runpath]
├── libm.so.6 (skipped) [runpath]
└── libc.so.6 (skipped) [runpath]

vs

patchelf --print-needed ruby
libruby-2.7.4.so.2.7
libz.so.1
libpthread.so.0
librt.so.1
libdl.so.2
libcrypt.so.1
libm.so.6
libc.so.6
@haampie
Copy link
Owner

haampie commented Dec 8, 2021

Thanks, I addressed this in the C rewrite, see https://github.com/haampie/libtree-in-c (soon to be moved to this repo).

Typically when libc / stdc++ / gcc_s type of libs are hidden, output fits to the screen, this is what I care about.

libtree 2.0.0 hides many more libraries, which I now think is a mistake. The reason for this is that the list was originally taken from what AppImage people use when bundling Qt applications.

Currently the line count of ldd is typically inbetween libtree and libtree -v. Maybe one additional verbosity mode would not hurt: print all libraries, but only once. Then libtree should have the same verbosity as ldd, but printed as a pruned tree.

Finally, the C rewrite has one more level of verbosity already, and also prints the exclude list:

# ./libtree --help
Show the dynamic dependency tree of ELF files
Usage: libtree [OPTION]... [FILE]...

  -h, --help     Print help info
      --version  Print version info

File names starting with '-', for example '-.so', can be specified as follows:
  libtree -- -.so

A. Locating libs options:
  -p, --path     Show the path of libraries instead of the soname
  -v             Show libraries skipped by default*
  -vv            Show dependencies of libraries skipped by default*
  -vvv           Show dependencies of already encountered libraries

*) For brevity, the following libraries are not shown by default:
   libc.so, libpthread.so, libm.so, libgcc_s.so, libstdc++.so, 
   ld-linux-x86-64.so, libdl.so.

@fzakaria
Copy link
Contributor Author

fzakaria commented Dec 8, 2021

FWIW I find it cool to see the whole tree:

❯ ./result/bin/libtree /nix/store/2r14xjbp68pvsw44hj9xjy39vmid6vq4-ruby-2.7.4/bin/ruby
ruby
├── libruby-2.7.4.so.2.7 [runpath]
│   ├── libz.so.1 [runpath]
│   │   └── libc.so.6 [runpath]
│   │       └── ld-linux-x86-64.so.2 [ld.so.conf]
│   ├── libpthread.so.0 [runpath]
│   │   ├── libc.so.6 (collapsed) [ld.so.conf]
│   │   └── ld-linux-x86-64.so.2 (collapsed) [ld.so.conf]
│   ├── librt.so.1 [runpath]
│   │   ├── libpthread.so.0 (collapsed) [ld.so.conf]
│   │   └── libc.so.6 (collapsed) [ld.so.conf]
│   ├── libdl.so.2 [runpath]
│   │   ├── libc.so.6 (collapsed) [ld.so.conf]
│   │   └── ld-linux-x86-64.so.2 (collapsed) [ld.so.conf]
│   ├── libcrypt.so.1 [runpath]
│   │   └── libc.so.6 (collapsed) [ld.so.conf]
│   ├── libm.so.6 [runpath]
│   │   ├── libc.so.6 (collapsed) [ld.so.conf]
│   │   └── ld-linux-x86-64.so.2 (collapsed) [ld.so.conf]
│   ├── libc.so.6 (collapsed) [runpath]
│   └── ld-linux-x86-64.so.2 (collapsed) [runpath]
├── libz.so.1 (collapsed) [runpath]
├── libpthread.so.0 (collapsed) [runpath]
├── librt.so.1 (collapsed) [runpath]
├── libdl.so.2 (collapsed) [runpath]
├── libcrypt.so.1 (collapsed) [runpath]
├── libm.so.6 (collapsed) [runpath]
└── libc.so.6 (collapsed) [runpath]

Might be an opportunity to also hide the collapsed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants