nixos/stage-1: Make find-libs not choke on dynamic linker being in DT_NEEDED

find-libs is currently choking when it finds the dynamic linker
as a DT_NEEDED dependency (from glibc) and bails out like this
(as glibc doesn't have a RPATH):

Couldn't satisfy dependency ld-linux-x86-64.so.2

Actually the caller of find-libs ignores the exit status, so the issue
almost always goes unnoticed and happens to work by chance. But
additionally what happens is that indirect .so dependencies are
left out from the dependency closure calculation, which breaks
latest cryptsetup as libssl.so isn't found anymore.
This commit is contained in:
Tuomas Tynkkynen 2018-06-20 05:17:26 +03:00
parent d91c70171f
commit f9218b1346

View File

@ -56,6 +56,12 @@ let
left=("''${left[@]:3}") left=("''${left[@]:3}")
if [ -z ''${seen[$next]+x} ]; then if [ -z ''${seen[$next]+x} ]; then
seen[$next]=1 seen[$next]=1
# Ignore the dynamic linker which for some reason appears as a DT_NEEDED of glibc but isn't in glibc's RPATH.
case "$next" in
ld*.so.?) continue;;
esac
IFS=: read -ra paths <<< $rpath IFS=: read -ra paths <<< $rpath
res= res=
for path in "''${paths[@]}"; do for path in "''${paths[@]}"; do