Fix package-manager script wrongly escaping UTF-8 chars in path names (bnc #571410)
authorMichael Andres <ma@suse.de>
Wed, 10 Feb 2010 11:39:06 +0000 (12:39 +0100)
committerMichael Andres <ma@suse.de>
Wed, 10 Feb 2010 11:39:06 +0000 (12:39 +0100)
tools/package-manager/package-manager

index 57a51a9..d00f47d 100755 (executable)
@@ -13,11 +13,16 @@ EOF
 }
 
 # quoted concatenation of arguments
+function quote() {
+  # formerly used 'printf %q' breaks UTF-8 strings
+  echo -n "$@" | sed 's/\([]|&;<>()$`\" \t*?#~=%[]\)/\\\1/g'
+}
+
 function mkCmd() {
-  printf "%q" "$1"
+  quote "$1"
   shift
   for ARG in "$@"; do
-    printf " %q" "$ARG"
+    echo -n " $(quote "$ARG")"
   done
 }