The following commit has been merged in the master branch:
commit a229ea46e701af1c8d55ae44bb61b025af00ec1e
Author: Ville Skyttä <[email protected]>
Date:   Wed Dec 14 21:54:49 2011 +0200

    _parse_help, _parse_usage: More command arg sanitization.
    
    http://thread.gmane.org/gmane.comp.shells.bash.completion.devel/3620

diff --git a/bash_completion b/bash_completion
index ebebb8e..84e4351 100644
--- a/bash_completion
+++ b/bash_completion
@@ -750,9 +750,12 @@ __parse_options()
 #
 _parse_help()
 {
-    eval local cmd=$1
+    eval local cmd=$( quote "$1" )
     local line
-    { case $cmd in -) cat ;; *) "$cmd" ${2:---help} 2>&1 ;; esac } \
+    { case $cmd in
+        -) cat ;;
+        *) "$( dequote "$cmd" )" ${2:---help} 2>&1 ;;
+      esac } \
     | while read -r line; do
 
         [[ $line == *([ $'\t'])-* ]] || continue
@@ -772,9 +775,12 @@ _parse_help()
 #
 _parse_usage()
 {
-    eval local cmd=$1
+    eval local cmd=$( quote "$1" )
     local line match option i char
-    { case $cmd in -) cat ;; *) "$cmd" ${2:---usage} 2>&1 ;; esac } \
+    { case $cmd in
+        -) cat ;;
+        *) "$( dequote "$cmd" )" ${2:---usage} 2>&1 ;;
+      esac } \
     | while read -r line; do
 
         while [[ $line =~ \[[[:space:]]*(-[^]]+)[[:space:]]*\] ]]; do

-- 
bash-completion

_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-commits

Reply via email to