Blob Blame History Raw
From ba5b59498d225f237edb02bc6774308597ea8d8f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 20 May 2014 11:27:42 +0200
Subject: [PATCH] dracut-functions.sh:print_vars() fix for values with spaces
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

for a variable with spaces, e.g.:
EXT_KEYMAPS='backspace keypad euro2'

The following would occur:
print_vars: eval printf -v _value %s '$EXT_KEYMAPS'
print_vars: printf -v _value %s backspace keypad euro2
print_vars: [[ -n backspacekeypadeuro2 ]]
print_vars: printf '%s=\"%s\"\n' EXT_KEYMAPS backspacekeypadeuro2

Thanks to Sebastian Köln for the fix!
---
 dracut-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dracut-functions.sh b/dracut-functions.sh
index 391b549b27..6754cc5e29 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -221,7 +221,7 @@ print_vars() {
 
     for _var in "$@"
     do
-        eval printf -v _value "%s" "\$$_var"
+        eval printf -v _value "%s" \""\$$_var"\"
         [[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
     done
 }
-- 
1.9.3