From 8fe4a73f9a487db2ec931d1d1e1e4f674a616d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 23 Oct 2011 11:32:13 +0300 Subject: _completion_loader: Use _minimal instead of _longopt as fallback. _longopt may end up invoking the completed command with --help which may not be safe for all arbitrary commands out there. --- bash_completion | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bash_completion b/bash_completion index 7aa16c6e..8b6cdb4f 100644 --- a/bash_completion +++ b/bash_completion @@ -1817,6 +1817,15 @@ _install_xspec '!@(*.@(ks|jks|jceks|p12|pfx|bks|ubr|gkr|cer|crt|cert|p7b|pkipath _install_xspec '!*.@(mp[234c]|og[ag]|@(fl|a)ac|m4[abp]|spx|tta|w?(a)v|wma|aif?(f)|asf|ape)' kid3 kid3-qt unset -f _install_xspec +# Minimal completion to use as fallback in _completion_loader. +_minimal() +{ + local cur prev words cword split + _init_completion -s || return + $split && return + _filedir +} + # set up dynamic completion loading _completion_loader() { @@ -1837,7 +1846,7 @@ _completion_loader() . "$compdir/${1##*/}" &>/dev/null && return 124 # Need to define *something*, otherwise there will be no completion at all. - complete -F _longopt "$1" && return 124 + complete -F _minimal "$1" && return 124 } && complete -D -F _completion_loader -- cgit v1.2.1