We don't need to do "complete -o filenames ..." when installing
bash-completion completions any longer (they should be handled
"internally"), but there are external completions which do that and
need it in effect also when completing with nice, sudo and friends.
Turn it on dynamically when needed instead; see doc/styleguide.txt for
a longer explanation. This fixes many non-filename completions which
had been previously more or less broken due to unwanted
escape-as-filenames behavior.
_usergroup now has a -u option, and there are new _allowed_users and
_allowed_groups helpers. These can be used to limit returned users
and/or groups to ones that the user has access to (or should be
assumed to have access to if running a "root command").
I had to remove a couple of "funky user" chown test cases because for
some reason they were broken by this change, I didn't immediately find
out why, and I couldn't come up with a valid use case that should be
supported for them that would be more beneficial than the relevance
improvements in this patch.
This effectively turns off avahi-browse by default; doing it by
default is not worth it compared to the number of various (mostly
slowness) problems it has caused people, for example Alioth #312691
and RedHat #630326.
Mandriva has applied a similar patch for some time already, although
their environment variable name was different ($COMP_AVAHI_BROWSE).
This provides a bit of case insensivity to file extension matching,
allowing for example _filedir foo to match both *.foo and *.FOO. Note
that this is not real case insensivity; mixed case extensions like
*.FOO.gz are not matched by _filedir foo.gz so those need to be
handled like before this change.
Used `type compopt' instead of `compopt' to detect availability of
compopt because (at least on Ubuntu) a python-command-not-found handler
is started when issuing a non-existing command, thus resulting in
considerable slower completions on systems without compopt (bash < 4.0).
This fixes tilde completion when doing for instance `ls ~<TAB>'. See
also: Alioth #312613.
Added _tilde() helper function.
Contrary to _expand() and __expand_tilde_by_ref(), _tilde() also leaves the
tilde (~) intact. Replacement of the tilde has been a complaint in other
bugreports, especially since plain bash completion (without bash-completion
installed) doesn't expand the tilde when doing a `ls ~<TAB>'.
To run the tests:
./run completion/ls.exp
./run unit/_tilde.exp