glusterfs/extras/command-completion
Paul Stauffer 0bd9beabd2 bash-completion: Swap order of characters in egrep bracket expression
With glusterfs-cli installed, bash tab completion fails to work and prints an
error message:

    $ gluster volgrep: Invalid range end
    ^C

The problem is caused by the ordering of characters within an egrep bracket
expression in the "_gluster_completion()" function defined in
/etc/bash_completion.d/gluster.  The file contains this line:

    egrep -ao --color=never "([A-Za-z0-9_-.]+)|[[:space:]]+|." |  \

And egrep is interpreting the "-" character in that bracket expression as
indicating a range is being requested, "_-." Fortunately, "_" actually comes
after ".", this range expression is invalid, and egrep throws the error instead
of silently not doing what was intended.

The fix is simply to swap the positions of "-" and "." in that bracket
expression:

    egrep -ao --color=never "([A-Za-z0-9_.-]+)|[[:space:]]+|." |  \

With this change, bash tab completion works as intended.

Change-Id: Iace2d57a1122b4530987ba6f5f5558b56b094665
BUG: 1243108
Signed-off-by: Paul Stauffer <paulds@horde.com>
Reviewed-on: http://review.gluster.org/11939
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
2015-09-08 07:49:30 -07:00
..
gluster.bash bash-completion: Swap order of characters in egrep bracket expression 2015-09-08 07:49:30 -07:00
Makefile extras: bash command completion for gluster 2014-06-13 09:56:39 -07:00
README extras: bash command completion for gluster 2014-06-13 09:56:39 -07:00

This file is not moved to /etc/bash_completion.d/ with the source installation.
Please execute make install explicity from here to move this file to
/etc/bash_completion.d

Similarly, use make uninstall to remove it from /etc/bash_completion.d