Skip to contentSkip to conversation

dracut-functions.sh: Avoid loading unnecessary 32-bit libraries for 64-bit initrds

PATCH In review Colin Guthrie 3 participants 3 messages Nov 2, 2013 – Nov 5, 2013 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dracut-functions.sh: Avoid loading unnecessary 32-bit libraries for 64-bit initrds

Due to the 'inst_libdir_file "libnss_files*"' in the udev-rules module this caues the /usr/lib/libnss_files-2.18.so* to be included. This is a 32-bit library and pulls in a 32-bit version of glibc also even on a 64-bit system.

This is due to the fact that ldconfig -pN will print [/usr]/lib paths from the cache as well as [/usr]/lib64. As we handle these paths specifically we should ignore these results from the cache.

Also there was a missing space when appending the ldconfig paths onto our list meaning the last builtin and first ldconfig path were unusable.

---
 dracut-functions.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
dracut-functions.sh +2 -1
index 2e6e845..1355aca 100755
@@ -65,6 +65,7 @@ ldconfig_paths()
             printf "%s\n" ${d%/*};
         done
     ); do
+        [[ "$i" = "/lib" || "$i" = "/usr/lib" || "$i" = "/lib64" || "$i" = "/usr/lib64" ]] && continue
         a["$i"]=1;
     done;
     printf "%s\n" ${!a[@]}
@@ -81,7 +82,7 @@ if ! [[ $libdirs ]] ; then
         [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
     fi
 
-    libdirs+="$(ldconfig_paths)"
+    libdirs+=" $(ldconfig_paths)"
 
     export libdirs
 fi
Signature · 1 line
1.8.4

A message that is not in the archive (sent off-list or not yet received): 1383391590-437-1-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org

#2 lore raw

В Sat, 2 Nov 2013 11:26:30 +0000
Colin Guthrie <[email protected]> пишет:

Quoted 21 lines

Due to the 'inst_libdir_file "libnss_files*"' in the udev-rules module this caues the /usr/lib/libnss_files-2.18.so* to be included. This is a 32-bit library and pulls in a 32-bit version of glibc also even on a 64-bit system.

This is due to the fact that ldconfig -pN will print [/usr]/lib paths from the cache as well as [/usr]/lib64. As we handle these paths specifically we should ignore these results from the cache.

Also there was a missing space when appending the ldconfig paths onto our list meaning the last builtin and first ldconfig path were unusable.

---
 dracut-functions.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
dracut-functions.sh +0 -0
index 2e6e845..1355aca 100755

dracut-functions.sh ldconfig_paths() · line 69

Quoted 5 lines
dracut-functions.sh +1 -0
@@ -65,6 +65,7 @@ ldconfig_paths()
             printf "%s\n" ${d%/*};
         done
     ); do
+        [[ "$i" = "/lib" || "$i" = "/usr/lib" || "$i" = "/lib64" ||
 "$i" = "/usr/lib64" ]] && continue a["$i"]=1;

"/lib32" and "/usr/lib32" should be also excluded. In Gentoo by default we have 32-bit binaries in lib32 and lib is a symlink to lib64.

Quoted 11 lines
dracut-functions.sh +1 -1
     done;
     printf "%s\n" ${!a[@]}
@@ -81,7 +82,7 @@ if ! [[ $libdirs ]] ; then
         [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
     fi
 
-    libdirs+="$(ldconfig_paths)"
+    libdirs+=" $(ldconfig_paths)"
 
     export libdirs
 fi
Signature · 1 line
Alexander Tsoy

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

'Twas brillig, and Alexander Tsoy at 04/11/13 21:53 did gyre and gimble:

Quoted 19 lines

В Sat, 2 Nov 2013 11:26:30 +0000
Colin Guthrie <[email protected]> пишет:

Quoted 16 lines

Due to the 'inst_libdir_file "libnss_files*"' in the udev-rules module this caues the /usr/lib/libnss_files-2.18.so* to be included. This is a 32-bit library and pulls in a 32-bit version of glibc also even on a 64-bit system.

This is due to the fact that ldconfig -pN will print [/usr]/lib paths from the cache as well as [/usr]/lib64. As we handle these paths specifically we should ignore these results from the cache.

Also there was a missing space when appending the ldconfig paths onto our list meaning the last builtin and first ldconfig path were unusable.

---
 dracut-functions.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

dracut-functions.sh ldconfig_paths() · line 69

Quoted 10 lines
dracut-functions.sh +1 -0
index 2e6e845..1355aca 100755
@@ -65,6 +65,7 @@ ldconfig_paths()
             printf "%s\n" ${d%/*};
         done
     ); do
+        [[ "$i" = "/lib" || "$i" = "/usr/lib" || "$i" = "/lib64" ||
 "$i" = "/usr/lib64" ]] && continue a["$i"]=1;

"/lib32" and "/usr/lib32" should be also excluded. In Gentoo by default we have 32-bit binaries in lib32 and lib is a symlink to lib64.

Looking through the dracut code it doesn't seem to specially handled [/usr]/lib32 at all (unlike the special handling for [/usr]/lib64).

So my logic here was that the folders are already "handled" via specific code and thus should be ignored from the cached results.

As lib32 is not already "handled", it shouldn't be ignored. However, that basically doesn't work in practice!

I guess it would make make sense to add a second line after the above one to do the [/usr]/lib32 ignoring - I think keeping them separate makes sense (and with a separate commit message) as they are dealing with slightly different cases.

Harald, are you OK to do something like that after pulling this one?

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/