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