commit:     4f303b048743f494a79916a0a30ecb3b027164b7
Author:     Guillaume Castagnino <gcastagnino <AT> denyall <DOT> com>
AuthorDate: Fri Jan 16 11:57:15 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Jan 16 11:58:02 2015 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=4f303b04

fix https://bugs.gentoo.org/show_bug.cgi?id=536758

The shill version of shell_var is not correctly escaping vars

---
 sh/functions.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sh/functions.sh b/sh/functions.sh
index 368bb73..d82d72a 100644
--- a/sh/functions.sh
+++ b/sh/functions.sh
@@ -33,11 +33,14 @@ if [ -z "$(command -v service_set_value >/dev/null 2>&1)" 
]; then
        }
 
        shell_var() {
-               local output=$1 sanitized_arg=
-               shift 1
+               local output= sanitized_arg=
                for arg; do
                        sanitized_arg="${arg//[^a-zA-Z0-9_]/_}"
-                       output="$output $arg"
+                       if [ x"$output" = x"" ] ; then
+                               output=$sanitized_arg
+                       else
+                               output="$output $sanitized_arg"
+                       fi
                done
                echo "$output"
        }

Reply via email to