haampie / libtree

ldd as a tree
MIT License
2.67k stars 60 forks source link

Sysroot support #79

Open ekilmer opened 2 years ago

ekilmer commented 2 years ago

Hello, I am wondering more about why the --sysroot option was removed (https://github.com/haampie/libtree/commit/05ec3ac5e8f65083fd25fccb0380c11e30d63e89)?

My use-case is applying libtree to binaries/libraries from extracted firmware image filesystems where I might not be able to compile and run libtree on the device, and this feature would be very nice to have.

I implemented support (also rudimentary) for this myself before I noticed the aforementioned commit that reverted this functionality.

Thank you!

haampie commented 2 years ago

It was implemented rather quickly and I didn't want to release it. One open issue was that it wasn't testing whether paths where pointing outside the sysroot, and I didn't want to add realpath type of functions to libtree. Maybe I shouldn't care about going outside the sysroot, since libtree is just a simple read-only utility.

FWIW, libtree barely uses any memory, so it might as well work on not so powerful devices. Otherwise you could maybe use bwrap or some other tool to chroot inside your environment and run a statically compiled libtree there.

ekilmer commented 2 years ago

Understood! Thank you for the details.

I will look into bwrap.

When I can emulate or access the device in question, I have done as you suggested and statically compiled libtree to run within the environment, which works very well!

I'm unsure if you want to leave this issue open or close, so feel free to close it if you wish.