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

bugzilla at redhat.com bugzilla at redhat.com
Tue Aug 18 04:57:45 UTC 2015


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

            Bug ID: 1254416
           Summary: bash tab completion fails with "grep: Invalid range
                    end"
           Product: GlusterFS
           Version: 3.7.2
         Component: cli
          Keywords: Triaged
          Assignee: bugs at gluster.org
          Reporter: ndevos at redhat.com
                CC: bugs at gluster.org, gluster-bugs at redhat.com
        Depends On: 1243108



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


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1243108
[Bug 1243108] 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