Bug 1318750 - 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: 3.7.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On: 1243108
Blocks: 1254416
TreeView+ depends on / blocked
 
Reported: 2016-03-17 16:54 UTC by Paul Stauffer
Modified: 2016-04-19 07:00 UTC (History)
4 users (show)

Fixed In Version: glusterfs-3.7.10
Clone Of: 1243108
Environment:
Last Closed: 2016-04-19 07:00:16 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Paul Stauffer 2016-03-17 16:54:29 UTC
+++ This bug was initially created as a clone of Bug #1243108 +++

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.

--- Additional comment from Ravishankar N on 2015-07-21 08:16:44 EDT ---

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 00:03:05 EDT ---

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)

--- Additional comment from Anand Avati on 2015-08-18 00:56:56 EDT ---

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)

--- Additional comment from Anand Avati on 2015-08-18 00:58:27 EDT ---

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)

--- Additional comment from Anand Avati on 2015-09-01 04:21:39 EDT ---

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)

--- Additional comment from Ravishankar N on 2015-09-24 05:09:49 EDT ---

Patch seems to have been merged, moving BZ to MODIFIED.

--- Additional comment from Paul Stauffer on 2016-03-10 14:59:26 EST ---

Was this patch actually ever merged?  The latest 3.7.8 packages in the gluster.org repos still exhibit the same problem.

--- Additional comment from Ravishankar N on 2016-03-10 20:11:10 EST ---

(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 1 Vijay Bellur 2016-03-17 17:22:10 UTC
REVIEW: http://review.gluster.org/13767 (Swap order of characters in egrep bracket expression to fix Bug 1318750.) posted (#1) for review on release-3.7 by Paul Stauffer (paulds)

Comment 2 Vijay Bellur 2016-03-17 17:22:13 UTC
REVIEW: http://review.gluster.org/13769 (Swap order of characters in egrep bracket expression to fix Bug 1318750.) posted (#1) for review on release-3.7 by Paul Stauffer (paulds)

Comment 3 Paul Stauffer 2016-03-17 17:29:58 UTC
I'm still a git newbie, so I may have done that commit wrong... I forgot to add the Signed-off-by the first time, which rfc.sh helpfully reminded me, so I tried to revert the commit and redo it.  That seems to have generated three changes in Gerrit.  Sorry if this caused extra hassle.

Comment 4 Ravishankar N 2016-03-18 01:26:52 UTC
Thanks, you could just abandon (go to the patch and click Abandon) the 2 spurious patches. BTW, if you want to resubmit a patch, you can make changes to the patch on your local repo, `git commit --amend` it and hit rfc.sh. Then the existing review URL would be updated with the latest revision,

Comment 5 Vijay Bellur 2016-03-18 01:29:36 UTC
REVIEW: http://review.gluster.org/13769 (bash-completion: Swap order of characters in egrep bracket expression) posted (#2) for review on release-3.7 by Ravishankar N (ravishankar)

Comment 6 Ravishankar N 2016-03-18 01:36:49 UTC
Vijay seems to have tagged 3.7.9 for release. So I guess this will make it to 3.7.10.

Comment 7 Vijay Bellur 2016-03-18 06:59:12 UTC
COMMIT: http://review.gluster.org/13769 committed in release-3.7 by Pranith Kumar Karampuri (pkarampu) 
------
commit 609d0cf8d678626224d70a8a8a269ab6076a5983
Author: Paul Stauffer <paulds>
Date:   Thu Mar 17 13:19:28 2016 -0400

    bash-completion: Swap order of characters in egrep bracket expression
    
    Backport of http://review.gluster.org/11939
    
    Change-Id: I5132a8ffb00d03932bc6bd801eeaf237b334e2e3
    BUG: 1318750
    Signed-off-by: Paul Stauffer <paulds>
    Reviewed-on: http://review.gluster.org/13769
    Reviewed-by: Ravishankar N <ravishankar>
    Tested-by: Ravishankar N <ravishankar>
    Smoke: Gluster Build System <jenkins.com>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.com>
    Reviewed-by: Pranith Kumar Karampuri <pkarampu>

Comment 8 Kaushal 2016-04-19 07:00:16 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.7.10, please open a new bug report.

glusterfs-3.7.10 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] https://www.gluster.org/pipermail/gluster-users/2016-April/026164.html
[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.