Bug 1243108 - bash tab completion fails with "grep: Invalid range end"
Summary: bash tab completion fails with "grep: Invalid range end"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: cli
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Paul Stauffer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1254416 1318750
TreeView+ depends on / blocked
 
Reported: 2015-07-14 19:13 UTC by Paul Stauffer
Modified: 2016-06-16 13:24 UTC (History)
4 users (show)

Fixed In Version: glusterfs-3.8rc2
Clone Of:
: 1254416 1318750 (view as bug list)
Environment:
Last Closed: 2016-06-16 13:24:08 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:
ndevos: needinfo-


Attachments (Terms of Use)

Description Paul Stauffer 2015-07-14 19:13:47 UTC
With glusterfs-cli installed, bash tab completion fails to work and prints an error message:

$ gluster volgrep: Invalid range end
^C

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.

Comment 1 Ravishankar N 2015-07-21 12:16:44 UTC
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

Comment 2 Anand Avati 2015-08-18 04:03:05 UTC
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 (paulds)

Comment 3 Anand Avati 2015-08-18 04:56:56 UTC
REVIEW: http://review.gluster.org/11939 (bash-completion: Swap order of characters in egrep bracket expression) posted (#2) for review on master by Niels de Vos (ndevos)

Comment 4 Anand Avati 2015-08-18 04:58:27 UTC
REVIEW: http://review.gluster.org/11939 (bash-completion: Swap order of characters in egrep bracket expression) posted (#3) for review on master by Niels de Vos (ndevos)

Comment 5 Anand Avati 2015-09-01 08:21:39 UTC
REVIEW: http://review.gluster.org/11939 (bash-completion: Swap order of characters in egrep bracket expression) posted (#4) for review on master by Vijay Bellur (vbellur)

Comment 6 Ravishankar N 2015-09-24 09:09:49 UTC
Patch seems to have been merged, moving BZ to MODIFIED.

Comment 7 Paul Stauffer 2016-03-10 19:59:26 UTC
Was this patch actually ever merged?  The latest 3.7.8 packages in the gluster.org repos still exhibit the same problem.

Comment 8 Ravishankar N 2016-03-11 01:11:10 UTC
(In reply to Paul Stauffer from comment #7)
> Was this patch actually ever merged?  The latest 3.7.8 packages in the
> gluster.org repos still exhibit the same problem.

Just checked, the patch is present in the 'master' branch but looks like it wasn't back-ported to the release-3.7 branch. You would need to clone this bug for 3.7.9 and send the patch there too. I can do it for you if you like.

Comment 9 Paul Stauffer 2016-03-17 17:24:40 UTC
Thanks; I took a stab at it. :)

Comment 10 Niels de Vos 2016-06-16 13:24:08 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.8.0, please open a new bug report.

glusterfs-3.8.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://blog.gluster.org/2016/06/glusterfs-3-8-released/
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user


Note You need to log in before you can comment on or make changes to this bug.