Skip to content

Commit 9dd2eab

Browse files
committed
fix(mysql): ensure generating "utf8" for charset
When there are no "charset" files, nothing has been generated although we intended to at least generate "utf8". The check for the number of generated candidates should be performed after generating "utf8". The wrong check has been introduced in commit 08dd2cd. Originally, we have been performing the pathname expansions without adjusting "nullglob", so the pattern "/usr/share/mysql/charsets/*.xml" has been directly strayed into the array "charsets" unless "nullgob" is set. Then the check has been always passed when "nullglob" is not set, which is the reason that we have been missing the problem until now.
1 parent 5d49f24 commit 9dd2eab

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

completions/mysql

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ _comp_xfunc_mysql_character_sets()
44
{
55
local -a charsets
66
_comp_expand_glob charsets '/usr/share/m{ariadb,ysql}/charsets/*.xml'
7-
if ((${#charsets[@]})); then
8-
charsets=("${charsets[@]##*/}")
9-
charsets=("${charsets[@]%%?(Index).xml}" utf8)
10-
local IFS=$'\n'
11-
COMPREPLY+=($(compgen -W '${charsets[@]}' -- "$cur"))
12-
fi
7+
charsets+=(utf8)
8+
charsets=("${charsets[@]##*/}")
9+
charsets=("${charsets[@]%%?(Index).xml}")
10+
local IFS=$'\n'
11+
COMPREPLY+=($(compgen -W '${charsets[@]}' -- "$cur"))
1312
}
1413

1514
_comp_deprecate_func _mysql_character_sets _comp_xfunc_mysql_character_sets

0 commit comments

Comments
 (0)