MSYS2-packages/bash-completion/002-Avoid-bad-array-subscript-on-commands-ending-with-slash.patch

24 lines
839 B
Diff

From 583562b9e56207bd428497ceb96df4e1f1f53158 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sun, 6 May 2018 21:41:48 +0200
Subject: [PATCH] __load_completion: Avoid bad array subscript on "commands"
ending with slash
Closes #209
---
bash_completion | 1 +
1 file changed, 1 insertion(+)
diff --git a/bash_completion b/bash_completion
index 9a9eae0ba4..442c07575c 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