Blob Blame History Raw
From 40a5d2c0291d4ec7d8c501fce8fb9d412235fdbb 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!

(cherry picked from commit 7a94a4326f0641396125acb2b444b562224457a1)
---
 dracut-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dracut-functions.sh b/dracut-functions.sh
index cb43f7ad..915f70fa 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -176,7 +176,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
 }