Blame SOURCES/0351-dracut-functions.sh-avoid-tokenizing-ldconfig-output.patch

64b87c
From 5263556ff3314d61e7e9da685bbd59bebc79efe1 Mon Sep 17 00:00:00 2001
64b87c
From: Lubomir Rintel <lkundrak@v3.sk>
64b87c
Date: Tue, 23 Dec 2014 22:03:10 +0100
64b87c
Subject: [PATCH] dracut-functions.sh: avoid tokenizing ldconfig output with
64b87c
 'read'
64b87c
64b87c
The space does not separate the elements reliably, spaces can be
64b87c
embedded in parenthesized expressions too:
64b87c
64b87c
  libgmpxx.so.4 (libc6, hwcap: 0x0000000004000000) => /lib/sse2/libgmpxx.so.4
64b87c
  libgmp.so.10 (libc6, hwcap: 0x0000000004000000) => /lib/sse2/libgmp.so.10
64b87c
64b87c
This results in dracut creating '0x0000000004000000' and '=>'
64b87c
directories in the initramfs image.
64b87c
64b87c
(cherry picked from commit c59779cf9337bc0fc48c7a4d8437f7253f6822c3)
64b87c
---
64b87c
 dracut-functions.sh | 12 +-----------
64b87c
 1 file changed, 1 insertion(+), 11 deletions(-)
64b87c
64b87c
diff --git a/dracut-functions.sh b/dracut-functions.sh
64b87c
index 585b683..9218779 100755
64b87c
--- a/dracut-functions.sh
64b87c
+++ b/dracut-functions.sh
64b87c
@@ -97,17 +97,7 @@ fi
64b87c
 
64b87c
 ldconfig_paths()
64b87c
 {
64b87c
-    local a i
64b87c
-    declare -A a
64b87c
-    for i in $(
64b87c
-        ldconfig -pN 2>/dev/null | grep -F '=>' | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | while read a b c d; do
64b87c
-            d=${d%/*}
64b87c
-            printf "%s\n" "$d";
64b87c
-        done
64b87c
-    ); do
64b87c
-        a["$i"]=1;
64b87c
-    done;
64b87c
-    printf "%s\n" ${!a[@]}
64b87c
+    ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
64b87c
 }
64b87c
 
64b87c
 # Detect lib paths