Blame SOURCES/0174-dracut-functions.sh-print_vars-fix-for-values-with-s.patch

a56a5e
From 40a5d2c0291d4ec7d8c501fce8fb9d412235fdbb Mon Sep 17 00:00:00 2001
a56a5e
From: Harald Hoyer <harald@redhat.com>
a56a5e
Date: Tue, 20 May 2014 11:27:42 +0200
a56a5e
Subject: [PATCH] dracut-functions.sh:print_vars() fix for values with spaces
a56a5e
MIME-Version: 1.0
a56a5e
Content-Type: text/plain; charset=UTF-8
a56a5e
Content-Transfer-Encoding: 8bit
a56a5e
a56a5e
for a variable with spaces, e.g.:
a56a5e
EXT_KEYMAPS='backspace keypad euro2'
a56a5e
a56a5e
The following would occur:
a56a5e
print_vars: eval printf -v _value %s '$EXT_KEYMAPS'
a56a5e
print_vars: printf -v _value %s backspace keypad euro2
a56a5e
print_vars: [[ -n backspacekeypadeuro2 ]]
a56a5e
print_vars: printf '%s=\"%s\"\n' EXT_KEYMAPS backspacekeypadeuro2
a56a5e
a56a5e
Thanks to Sebastian Köln for the fix!
a56a5e
a56a5e
(cherry picked from commit 7a94a4326f0641396125acb2b444b562224457a1)
a56a5e
---
a56a5e
 dracut-functions.sh | 2 +-
a56a5e
 1 file changed, 1 insertion(+), 1 deletion(-)
a56a5e
a56a5e
diff --git a/dracut-functions.sh b/dracut-functions.sh
a56a5e
index cb43f7a..915f70f 100755
a56a5e
--- a/dracut-functions.sh
a56a5e
+++ b/dracut-functions.sh
a56a5e
@@ -176,7 +176,7 @@ print_vars() {
a56a5e
 
a56a5e
     for _var in "$@"
a56a5e
     do
a56a5e
-        eval printf -v _value "%s" "\$$_var"
a56a5e
+        eval printf -v _value "%s" \""\$$_var"\"
a56a5e
         [[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
a56a5e
     done
a56a5e
 }