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

bugzilla at redhat.com bugzilla at redhat.com
Tue Jul 14 19:13:47 UTC 2015


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

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



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.

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