From 0d9a38bb576beac24d0694633a79cff7e8c11a9f Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Mon, 29 Oct 2012 16:21:24 +0530 Subject: features/quota: Failure of quota commands if the dir-name contains ':' in it PROBLEM: The first colon in the limit string is used to separate the path and the limit-value. The ':' in the path was the source of problem. FIX: Search for the last colon and separate based on the same. Added regression test. TEST: Create and set quota on directories with names containing ':' in start, middle and end. Change-Id: I363c8ad4cbfd02c23fc73974bef9aa8bc362d29c BUG: 848251 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/4137 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-848251.t | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/bugs/bug-848251.t (limited to 'tests') diff --git a/tests/bugs/bug-848251.t b/tests/bugs/bug-848251.t new file mode 100644 index 000000000..dda393272 --- /dev/null +++ b/tests/bugs/bug-848251.t @@ -0,0 +1,50 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/brick1; + +TEST $CLI volume start $V0; + +#enable quota +TEST $CLI volume quota $V0 enable; + +#mount on a random dir +TEST MOUNTDIR="/tmp/$RANDOM" +TEST mkdir $MOUNTDIR +TEST glusterfs -s $H0 --volfile-id=$V0 $MOUNTDIR + +function set_quota(){ + mkdir "$MOUNTDIR/$name" + $CLI volume quota $V0 limit-usage /$name 50KB +} + +function quota_list(){ + $CLI volume quota $V0 list | grep -- /$name | awk '{print $3}' +} + +TEST name=":d1" +#file name containing ':' in the start +TEST set_quota +EXPECT "0Bytes" quota_list + +TEST name=":d1/d:1" +#file name containing ':' in between +TEST set_quota +EXPECT "0Bytes" quota_list + +TEST name=":d1/d:1/d1:" +#file name containing ':' in the end +TEST set_quota +EXPECT "0Bytes" quota_list + +TEST umount $MOUNTDIR +TEST rm -rf $MOUNTDIR + +cleanup; -- cgit