You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

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