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

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