[Bash-completion-devel] [bash-completion-Bugs][314707] shopt -s failglob breaks _parse_help
bash-completion-bugs at alioth.debian.org
bash-completion-bugs at alioth.debian.org
Sun Jun 8 21:54:33 UTC 2014
bash-completion-Bugs item #314707 was changed at 2014-06-09 01:54 by Igor Murzov
You can respond by visiting:
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314707&group_id=100114
>Status: Closed
Priority: 3
Submitted By: Ville Skyttä (scop-guest)
Assigned to: Nobody (None)
Summary: shopt -s failglob breaks _parse_help
Distribution: None
Originally reported in: None
Milestone: None
>Status: Fix Committed
Original bug number:
Initial Comment:
With "shopt -s failglob" in test/config/bashrc:
$ ./runUnit _parse_help.exp
[...]
Running ./unit/_parse_help.exp ...
FAIL: long with value and eq sign in brackets
FAIL: long with [no]
FAIL: long with [no-] + optional arg
FAIL: long with [no-] + required arg
FAIL: long with [dont-]
FAIL: short and long with [dont]
FAIL: -f [FOO], --foo[=FOO]
Haven't investigated if this is real breakage or if it's just the test case that gets broken somehow.
----------------------------------------------------------------------
>Comment By: Igor Murzov (garik-guest)
Date: 2014-06-09 01:54
Message:
Thanks for the patch, Damien. Fix commited.
----------------------------------------------------------------------
Comment By: Igor Murzov (garik-guest)
Date: 2014-06-05 00:37
Message:
Looks good to me.
----------------------------------------------------------------------
Comment By: Dams Nadé (anvil-guest)
Date: 2014-06-02 22:12
Message:
Found an issue, located in __parse_options. One should never do "for i in $var" nor "for i in $(cmd)".
I cant seem to attach any document, so here's the inlined patch :
diff --git a/bash_completion b/bash_completion
index 3e5c813..d61b257 100644
--- a/bash_completion
+++ b/bash_completion
@@ -742,8 +742,10 @@ __parse_options()
# Take first found long option, or first one (short) if not found.
option=
- for i in $1; do
- case $i in
+ local -a array
+ read -a array <<<"$1"
+ for i in "${array[@]}"; do
+ case "$i" in
---*) break ;;
--?*) option=$i ; break ;;
-?*) [[ $option ]] || option=$i ;;
----------------------------------------------------------------------
You can respond by visiting:
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=314707&group_id=100114
More information about the Bash-completion-devel
mailing list