[Bash-completion-devel] bash autocomplete triggers an ldap request
Dean Sniegowski
sniegowski at gmail.com
Wed Dec 3 00:16:45 UTC 2014
I've noticed my bash autocomplete will frequently hang.
System info:
I'm running Ubuntu 14.04.1
Bash Autocomplete 2.1-4
Authentication using sssd configured for kerberos and ldap
Suspected Cause:
in _quote_readline_by_ref() has a line elif [[ $1 == ~* ]]; then
It appears this line causes sssd to make an ldap request for all the
accounts which take a couple of seconds.
I'm fairly certain this is the cause because if I delete that elif, the
delay goes away and there are no ldap requests.
Is this a bug or is it intended to retrieve all home directories?
complete function
# This function quotes the argument in a way so that readline dequoting
# results in the original argument. This is necessary for at least
# `compgen' which requires its arguments quoted/escaped:
#
# $ ls "a'b/"
# c
# $ compgen -f "a'b/" # Wrong, doesn't return output
# $ compgen -f "a\'b/" # Good
# a\'b/c
#
# See also:
# - http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
# - http://www.mail-archive.com/bash-completion-devel@lists.alioth.\
# debian.org/msg01944.html
# @param $1 Argument to quote
# @param $2 Name of variable to return result to
_quote_readline_by_ref()
{
if [ -z "$1" ]; then
# avoid quoting if empty
printf -v $2 %s "$1"
elif [[ $1 == \'* ]]; then
# Leave out first character
printf -v $2 %s "${1:1}"
elif [[ $1 == ~* ]]; then
# avoid escaping first ~
printf -v $2 ~%q "${1:1}"
else
printf -v $2 %q "$1"
fi
# Replace double escaping ( \\ ) by single ( \ )
# This happens always when argument is already escaped at cmdline,
# and passed to this function as e.g.: file\ with\ spaces
[[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
# If result becomes quoted like this: $'string', re-evaluate in order to
# drop the additional quoting. See also: http://www.mail-archive.com/
# bash-completion-devel at lists.alioth.debian.org/msg01942.html
[[ ${!2} == \$* ]] && eval $2=${!2}
} # _quote_readline_by_ref()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20141202/888e18ef/attachment-0001.html>
More information about the Bash-completion-devel
mailing list