[Bugs] [Bug 1318750] New: bash tab completion fails with "grep: Invalid range end"

bugzilla at redhat.com bugzilla at redhat.com
Thu Mar 17 16:54:29 UTC 2016


https://bugzilla.redhat.com/show_bug.cgi?id=1318750

            Bug ID: 1318750
           Summary: bash tab completion fails with "grep: Invalid range
                    end"
           Product: GlusterFS
           Version: 3.7.9
         Component: cli
          Keywords: Triaged
          Assignee: bugs at gluster.org
          Reporter: paulds at horde.com
                CC: amukherj at redhat.com, bugs at gluster.org,
                    paulds at horde.com, ravishankar at redhat.com
        Depends On: 1243108
            Blocks: 1254416



+++ 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 at horde.com)

--- 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 at redhat.com)

--- 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 at redhat.com)

--- 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 at redhat.com)

--- 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.


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1243108
[Bug 1243108] bash tab completion fails with "grep: Invalid range end"
https://bugzilla.redhat.com/show_bug.cgi?id=1254416
[Bug 1254416] bash tab completion fails with "grep: Invalid range end"
-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list