From: Joao Eduardo Luis Date: Tue, 30 Sep 2014 17:49:19 +0000 (+0100) Subject: qa/workunits: mon: auth_caps: variables must be local X-Git-Tag: v0.87~41^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c7d5c25324ef6eeb279a7a8674d300773ba1889f;p=ceph.git qa/workunits: mon: auth_caps: variables must be local We have variables with the same name that are being shared! We don't hit any issues with it currently because the code just kind of works even though that happens. Add a bit of new logic that relies on an immutable return code (for instance) and we're in the woods. Signed-off-by: Joao Eduardo Luis --- diff --git a/qa/workunits/mon/auth_caps.sh b/qa/workunits/mon/auth_caps.sh index f150abdd8172..43d5747ce2df 100755 --- a/qa/workunits/mon/auth_caps.sh +++ b/qa/workunits/mon/auth_caps.sh @@ -24,7 +24,10 @@ trap "rm $tmp" INT ERR EXIT QUIT 0 expect() { set +e - expected_ret=$1 + + local expected_ret=$1 + local ret + shift cmd=$@ @@ -42,10 +45,11 @@ expect() { } read_ops() { + local caps=$1 + local has_read=1 has_exec=1 + local ret + local args - caps=$1 - has_read=1 - has_exec=1 ( echo $caps | grep 'r' ) || has_read=0 ( echo $caps | grep 'x' ) || has_exec=0 @@ -72,10 +76,11 @@ read_ops() { write_ops() { - caps=$1 - has_read=1 - has_write=1 - has_exec=1 + local caps=$1 + local has_read=1 has_write=1 has_exec=1 + local ret + local args + ( echo $caps | grep 'r' ) || has_read=0 ( echo $caps | grep 'w' ) || has_write=0 ( echo $caps | grep 'x' ) || has_exec=0