Last active
December 11, 2022 00:07
-
-
Save kth5/728ef3fc3661c2066d22287eb56adc6e to your computer and use it in GitHub Desktop.
Simple script to find binaries and shared objects missing direct linked libraries (readelf vs ldd) with pacman support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SOLIBS=$(find /usr/lib -maxdepth 1 -type f -name "*.so.*") | |
BINS=$(find /usr/bin -maxdepth 1 -type f) | |
for file in ${SOLIBS[@]} ${BINS[@]}; do | |
sobump=0 | |
for solib in $(readelf -d ${file} 2>&1 | grep NEEDED | awk '{print $5}' | sed -e 's@\[@@g' -e 's@\]@@g' | sort -u); do | |
if [ ! -f /usr/lib/${solib} -a ! -f /usr/lib/*/${solib} ]; then | |
pkg=$(pacman -Qqo ${file}) | |
echo "${file} BAD: ${pkg} ${solib}"; | |
sobump=1 | |
fi | |
done | |
[ ${sobump} -eq 0 ] && echo "${file} OK" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Avoids ldd automatically resolving linked libraries and only finds directly linked objects missing.