summaryrefslogtreecommitdiff
path: root/debian/patches/15-bug-923167-fix-bad-array-subscript.patch
blob: d8bcc9cd60e96fd856429de52c996b07338728ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
commit 583562b9e56207bd428497ceb96df4e1f1f53158
Author: Ville Skyttä <ville.skytta@iki.fi>
Date:   Sun May 6 21:41:48 2018 +0200

    __load_completion: Avoid bad array subscript on "commands" ending with slash
    
    Closes #209

diff --git a/bash_completion b/bash_completion
index 9a9eae0b..442c0757 100644
--- a/bash_completion
+++ b/bash_completion
@@ -2019,6 +2019,7 @@ __load_completion()
 {
     local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions )
     local OIFS=$IFS IFS=: dir cmd="${1##*/}" compfile
+    [[ -n $cmd ]] || return 1
     for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
         dirs+=( $dir/bash-completion/completions )
     done