From 7e8a1b740f1e5640248e2fb70787f9b3a759028c Mon Sep 17 00:00:00 2001 From: macayu17 Date: Sun, 16 Aug 2026 01:14:32 +0530 Subject: [PATCH] pyenv-binary-save: document parsed dependency formats --- plugins/pyenv-binary/libexec/pyenv-binary-save | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/pyenv-binary/libexec/pyenv-binary-save b/plugins/pyenv-binary/libexec/pyenv-binary-save index 16019c71..8e2405b2 100755 --- a/plugins/pyenv-binary/libexec/pyenv-binary-save +++ b/plugins/pyenv-binary/libexec/pyenv-binary-save @@ -115,8 +115,12 @@ system_deps() { otool -L "$f" 2>/dev/null | tail -n +2 | awk -v pfx="${prefix}/" \ '$1 !~ /^@/ && substr($1, 1, length(pfx)) != pfx { print $1 }' else + # GNU binutils 2.44 writes "(NEEDED) ... [name]"; FreeBSD 15.1 writes + # "NEEDED ... [name]". readelf(1) documents -d, not its text format. needed="$(LC_ALL=C readelf -dW "$f" 2>/dev/null | awk \ '$2 == "(NEEDED)" || $2 == "NEEDED" { sub(/^.*\[/, ""); sub(/\].*$/, ""); print }' | tr '\n' ' ')" + # Linux and FreeBSD ldd write resolved libraries as + # "name => /absolute/path (address)"; entries without "=>" are ignored. LC_ALL=C ldd "$f" 2>/dev/null | awk -v needed="$needed" -v pfx="${prefix}/" ' BEGIN { split(needed, deps, " ")