]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-functions.sh:print_vars() fix for values with spaces
authorHarald Hoyer <harald@redhat.com>
Tue, 20 May 2014 09:27:42 +0000 (11:27 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 20 May 2014 09:31:16 +0000 (11:31 +0200)
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

index c7580293587a17d8b8375495363323994e65802b..12363d8c5809446b2ccf36624d3a5e561a52bef4 100755 (executable)
@@ -225,7 +225,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
 }