[Bugs] [Bug 1483607] New: get-gfid has bug in sed regexp

bugzilla at redhat.com bugzilla at redhat.com
Mon Aug 21 13:12:55 UTC 2017


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

            Bug ID: 1483607
           Summary: get-gfid has bug in sed regexp
           Product: GlusterFS
           Version: 3.10
         Component: scripts
          Assignee: bugs at gluster.org
          Reporter: bugzilla at ii.nl
                CC: bugs at gluster.org



Description of problem:

get-gfid.sh, which comes with the launchpad distribution, has a bug in the sed
regexp to get the path:


#!/bin/bash

ATTR_STR=`getfattr -h $1 -n glusterfs.gfid.string`
GLFS_PATH=`echo $ATTR_STR | sed -e 's/# file: \(.*\)
glusterfs.gfid.string*/\1/g'`
GFID=`echo $ATTR_STR | sed -e 's/.*glusterfs.gfid.string="\(.*\)"/\1/g'`

echo "$GFID $GLFS_PATH"


Which should be


#!/bin/bash

ATTR_STR=`getfattr -h $1 -n glusterfs.gfid.string`
GLFS_PATH=`echo $ATTR_STR | sed -e 's/# file: \(.*\)
glusterfs.gfid.string.*/\1/g'`
GFID=`echo $ATTR_STR | sed -e 's/.*glusterfs.gfid.string="\(.*\)"/\1/g'`

echo "$GFID $GLFS_PATH"

The difference is in the "string*" vs "string.*" in the second line. This
changes the output from weird to plausible:

root at gluster-1:/mnt/gluster/gl0/acme# /usr/share/glusterfs/scripts/get-gfid.sh
static.iidesk.com
fd099bd8-ee11-4456-95a4-f46597a3977e
static.iidesk.com="fd099bd8-ee11-4456-95a4-f46597a3977e"

vs

root at gluster-1:/mnt/gluster/gl0/acme# /usr/share/glusterfs/scripts/get-gfid.sh
static.iidesk.com
fd099bd8-ee11-4456-95a4-f46597a3977e static.iidesk.com

first is pre-fix, second example is post-fix.

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