Bug 1254416 - bash tab completion fails with "grep: Invalid range end"
Summary: bash tab completion fails with "grep: Invalid range end"
Keywords:
Status: CLOSED EOL
Alias: None
Product: GlusterFS
Classification: Community
Component: cli
Version: 3.7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: ankit
QA Contact:
URL:
Whiteboard:
Depends On: 1243108 1318750
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-18 04:57 UTC by Niels de Vos
Modified: 2017-03-08 10:50 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1243108
Environment:
Last Closed: 2017-03-08 10:50:28 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Niels de Vos 2015-08-18 04:57:45 UTC
+++ 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
^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 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 (paulds)

Comment 1 Kaushal 2017-03-08 10:50:28 UTC
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.


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