Red Hat Bugzilla – Bug 1254416
bash tab completion fails with "grep: Invalid range end"
Last modified: 2017-03-08 05:50:28 EST
+++ This bug was initially created as a clone of Bug #1243108 +++
+++ Use this bug to backport the change(s) from Bug #1243108 +++
With glusterfs-cli installed, bash tab completion fails to work and prints an error message:
$ gluster volgrep: Invalid range end
I have tested 3.6.3 and 3.7.2, both of which exhibit the problem.
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.
--- Additional comment from Ravishankar N on 2015-07-21 14:16:44 CEST ---
Triaged this bug as a part of the weekly meeting. Paul, would you like to send a patch for this? The workflow is here http://www.gluster.org/community/documentation/index.php/Development_Work_Flow
--- Additional comment from Anand Avati on 2015-08-18 06:03:05 CEST ---
REVIEW: http://review.gluster.org/11939 (Swap order of characters in egrep bracket expression to fix Bug 1243108.) posted (#1) for review on master by Anonymous Coward (email@example.com)
This bug is getting closed because GlusteFS-3.7 has reached its end-of-life.
Note: This bug is being closed using a script. No verification has been performed to check if it still exists on newer releases of GlusterFS.
If this bug still exists in newer GlusterFS releases, please reopen this bug against the newer release.