Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit f641c52

Browse files
authored
CORTX-30753: Codacy code cleanup(#1608) (#1857)
This patch fixes some of the codacy warnings. Warning fixed: "SC2006: Use $(...) notation instead of legacy backticked `...`". Signed-off-by: alfhad <[email protected]>
1 parent 3775a38 commit f641c52

10 files changed

+65
-65
lines changed

m0t1fs/linux_kernel/st/m0t1fs_poolmach.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#
2020

2121

22-
. `dirname "$0"`/common.sh
23-
. `dirname "$0"`/m0t1fs_common_inc.sh
24-
. `dirname "$0"`/m0t1fs_client_inc.sh
25-
. `dirname "$0"`/m0t1fs_server_inc.sh
22+
. $(dirname $0)/common.sh
23+
. $(dirname $0)/m0t1fs_common_inc.sh
24+
. $(dirname $0)/m0t1fs_client_inc.sh
25+
. $(dirname $0)/m0t1fs_server_inc.sh
2626

2727
pool_mach_test()
2828
{
@@ -125,7 +125,7 @@ main()
125125
{
126126
sandbox_init
127127

128-
NODE_UUID=`uuidgen`
128+
NODE_UUID=$(uuidgen)
129129
local multiple_pools=0
130130
motr_service start $multiple_pools
131131
if [ $? -ne "0" ]

m0t1fs/linux_kernel/st/m0t1fs_rconfc_fail_test.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#
2020

2121

22-
. `dirname "$0"`/common.sh
23-
. `dirname "$0"`/m0t1fs_common_inc.sh
24-
. `dirname "$0"`/m0t1fs_client_inc.sh
25-
. `dirname "$0"`/m0t1fs_server_inc.sh
26-
. `dirname "$0"`/m0t1fs_sns_common_inc.sh
22+
. $(dirname "$0")/common.sh
23+
. $(dirname "$0")/m0t1fs_common_inc.sh
24+
. $(dirname "$0")/m0t1fs_client_inc.sh
25+
. $(dirname "$0")/m0t1fs_server_inc.sh
26+
. $(dirname "$0")/m0t1fs_sns_common_inc.sh
2727

2828
. "$M0_SRC_DIR"/utils/functions # opcode
2929

@@ -98,7 +98,7 @@ rconfc_fatal_test()
9898
local file_base="$MOTR_M0T1FS_MOUNT_DIR/0:1"
9999
local bs=8192
100100
local count=150
101-
local LNET_NID=`lctl list_nids | head -1`
101+
local LNET_NID=$(lctl list_nids | head -1)
102102
local FAKE_HA_EP=$LNET_NID:12345:34:1
103103
local RM_EP=$LNET_NID:12345:33:100
104104
local CLIENT_EP=$LNET_NID:12345:34:1001
@@ -132,7 +132,7 @@ rconfc_fatal_test()
132132

133133
main()
134134
{
135-
NODE_UUID=`uuidgen`
135+
NODE_UUID=$(uuidgen)
136136
local rc
137137

138138
echo "*********************************************************"

m0t1fs/linux_kernel/st/m0t1fs_restart_motr_service.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ set +e
2323
## CAUTION: This path will be removed by superuser.
2424
SANDBOX_DIR=${SANDBOX_DIR:-/var/motr/sandbox.restart_motr_service}
2525

26-
. `dirname "$0"`/common.sh
27-
. `dirname "$0"`/m0t1fs_common_inc.sh
28-
. `dirname "$0"`/m0t1fs_client_inc.sh
29-
. `dirname "$0"`/m0t1fs_server_inc.sh
30-
. `dirname "$0"`/m0t1fs_sns_common_inc.sh
26+
. $(dirname "$0")/common.sh
27+
. $(dirname "$0")/m0t1fs_common_inc.sh
28+
. $(dirname "$0")/m0t1fs_client_inc.sh
29+
. $(dirname "$0")/m0t1fs_server_inc.sh
30+
. $(dirname "$0")/m0t1fs_sns_common_inc.sh
3131

3232
rcancel_sandbox="$MOTR_M0T1FS_TEST_DIR/rcancel_sandbox"
3333
source_file="$rcancel_sandbox/rcancel_source"
@@ -47,7 +47,7 @@ rcancel_motr_service_start()
4747

4848
main()
4949
{
50-
NODE_UUID=`uuidgen`
50+
NODE_UUID=$(uuidgen)
5151
local rc
5252

5353
sandbox_init

m0t1fs/linux_kernel/st/m0t1fs_rlock_revoke.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#
2020

2121

22-
. `dirname "$0"`/common.sh
23-
. `dirname "$0"`/m0t1fs_common_inc.sh
24-
. `dirname "$0"`/m0t1fs_client_inc.sh
25-
. `dirname "$0"`/m0t1fs_server_inc.sh
26-
. `dirname "$0"`/m0t1fs_sns_common_inc.sh
22+
. $(dirname "$0")/common.sh
23+
. $(dirname "$0")/m0t1fs_common_inc.sh
24+
. $(dirname "$0")/m0t1fs_client_inc.sh
25+
. $(dirname "$0")/m0t1fs_server_inc.sh
26+
. $(dirname "$0")/m0t1fs_sns_common_inc.sh
2727

2828
. "$M0_SRC_DIR"/utils/functions # opcode
2929

@@ -94,7 +94,7 @@ revoke_post()
9494

9595
revoke_read_lock()
9696
{
97-
local lnet_nid=`sudo lctl list_nids | head -1`
97+
local lnet_nid=$(sudo lctl list_nids | head -1)
9898
local s_endpoint="$lnet_nid:12345:33:100"
9999
local c_endpoint="$lnet_nid:12345:30:*"
100100
local delay=${1:-5}
@@ -155,7 +155,7 @@ revoke_test()
155155

156156
main()
157157
{
158-
NODE_UUID=`uuidgen`
158+
NODE_UUID=$(uuidgen)
159159
local rc
160160
local EXECUTOR
161161

m0t1fs/linux_kernel/st/m0t1fs_rpc_cancel_test.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#
2020

2121

22-
. `dirname $0`/common.sh
23-
. `dirname $0`/m0t1fs_common_inc.sh
24-
. `dirname $0`/m0t1fs_client_inc.sh
25-
. `dirname $0`/m0t1fs_server_inc.sh
26-
. `dirname $0`/m0t1fs_sns_common_inc.sh
22+
. $(dirname $0)/common.sh
23+
. $(dirname $0)/m0t1fs_common_inc.sh
24+
. $(dirname $0)/m0t1fs_client_inc.sh
25+
. $(dirname $0)/m0t1fs_server_inc.sh
26+
. $(dirname $0)/m0t1fs_sns_common_inc.sh
2727

2828
. $M0_SRC_DIR/utils/functions # opcode
2929

@@ -146,7 +146,7 @@ rcancel_post()
146146

147147
rcancel_change_controller_state()
148148
{
149-
local lnet_nid=`sudo lctl list_nids | head -1`
149+
local lnet_nid=$(sudo lctl list_nids | head -1)
150150
local s_endpoint="$lnet_nid:12345:33:1"
151151
local c_endpoint="$lnet_nid:$M0HAM_CLI_EP"
152152
local dev_fid=$1
@@ -299,18 +299,18 @@ rcancel_cancel_during_write_test()
299299
# It is to verify that some RPC items were indeed canceled through
300300
# RPC session cancelation. Some items are going to get canceled
301301
# while attempting to be posted after session cancelation.
302-
num=`grep -n "dd: " $MOTR_TEST_LOGFILE | grep "writing" | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' '`
302+
num=$(grep -n "dd: " $MOTR_TEST_LOGFILE | grep "writing" | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' ')
303303
echo "dd write processes canceled : $num"
304304
if [ $num -eq 0 ]; then
305305
echo "Failed: No dd writing operation was canceled"
306306
unmount_and_clean
307307
return 1
308308
fi
309309

310-
num=`grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' '`
310+
num=$(grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' ')
311311
echo "dd closing processes canceled : $num"
312312

313-
num=`grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' '`
313+
num=$(grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' ')
314314
echo "ls processes canceled : $num"
315315
if [ $num -gt 0 ] && [ $rcancel_md_redundancy > 1 ]; then
316316
echo "Failed: ls was canceled inspite-of having rcancel_md_redundancy ($rcancel_md_redundancy) > 1"
@@ -471,15 +471,15 @@ rcancel_cancel_during_read_test()
471471
# to verify that RPC session was indeed canceled.
472472
# Many of those read ops fail with the error "Input/output error"
473473
# while a few fail with the error "Operation canceled"
474-
num=`grep -n "dd: " $MOTR_TEST_LOGFILE | grep "reading" | egrep 'Operation canceled|Input\/output error' | grep "$rt_file_base" | wc -l | cut -f1 -d' '`
474+
num=$(grep -n "dd: " $MOTR_TEST_LOGFILE | grep "reading" | egrep 'Operation canceled|Input\/output error' | grep "$rt_file_base" | wc -l | cut -f1 -d' ')
475475
echo "dd read processes canceled : $num"
476476
if [ $num -eq 0 ]; then
477477
echo "Failed: No dd reading operation was canceled"
478478
unmount_and_clean
479479
return 1
480480
fi
481481

482-
num=`grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' '`
482+
num=$(grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' ')
483483
echo "dd closing processes canceled : $num"
484484

485485
# Test ls with canceled session
@@ -488,7 +488,7 @@ rcancel_cancel_during_read_test()
488488
ls -l "$rt_read_file_base"$i
489489
echo "ls_rc: $?"
490490
done
491-
num=`grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' '`
491+
num=$(grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' ')
492492
echo "ls processes canceled : $num"
493493
if [ $num -gt 0 ] && [ $rcancel_md_redundancy > 1 ]; then
494494
echo "Failed: ls was canceled inspite-of having rcancel_md_redundancy ($rcancel_md_redundancy) > 1"
@@ -585,7 +585,7 @@ rcancel_cancel_during_create_test()
585585

586586
# Verify that some create operations were indeed canceled due to
587587
# RPC session cancelation.
588-
num=`grep -n "touch: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$ct_create_file_base" | wc -l | cut -f1 -d' '`
588+
num=$(grep -n "touch: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$ct_create_file_base" | wc -l | cut -f1 -d' ')
589589
echo "create processes canceled : $num"
590590
if [ $num -eq 0 ]; then
591591
echo "Failed: No create operation was canceled"
@@ -679,7 +679,7 @@ rcancel_cancel_during_delete_test()
679679

680680
# Verify that some delete operations were indeed canceled due to
681681
# RPC session cancelation.
682-
num=`grep -n "rm: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$delete_file_base" | wc -l | cut -f1 -d' '`
682+
num=$(grep -n "rm: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$delete_file_base" | wc -l | cut -f1 -d' ')
683683
echo "delete processes canceled : $num"
684684
if [ $num -eq 0 ]; then
685685
echo "Failed: No delete operation was canceled"
@@ -761,7 +761,7 @@ rcancel_cancel_during_setfattr_ops_test()
761761

762762
# Verify that some setfattr operations were indeed canceled due to
763763
# RPC session cancelation.
764-
num=`grep -n "setfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$setfattr_file_base" | wc -l | cut -f1 -d' '`
764+
num=$(grep -n "setfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$setfattr_file_base" | wc -l | cut -f1 -d' ')
765765
echo "setfattr processes canceled : $num"
766766
if [ $num -eq 0 ]; then
767767
echo "Failed: No setfattr operation was canceled"
@@ -841,7 +841,7 @@ rcancel_cancel_during_getfattr_ops_test()
841841

842842
# Verify that some getfattr operations were indeed canceled due to
843843
# RPC session cancelation.
844-
num=`grep -n "getfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$getfattr_file_base" | wc -l | cut -f1 -d' '`
844+
num=$(grep -n "getfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$getfattr_file_base" | wc -l | cut -f1 -d' ')
845845
echo "getfattr processes canceled : $num"
846846
if [ $num -eq 0 ]; then
847847
if [ $rcancel_md_redundancy -eq $RCANCEL_MD_REDUNDANCY_1 ]; then
@@ -934,7 +934,7 @@ rcancel_test_cases()
934934
echo "TC.8.End: Session cancel with concurrent getfattr ops"
935935
echo "======================================================="
936936

937-
num=`grep -n "Connection timed out" $MOTR_TEST_LOGFILE | wc -l | cut -f1 -d' '`
937+
num=$(grep -n "Connection timed out" $MOTR_TEST_LOGFILE | wc -l | cut -f1 -d' ')
938938
echo "Connection timed out : $num"
939939
if [ $num -gt 0 ]; then
940940
echo "Failed: Connection timed out error has occurred"
@@ -974,7 +974,7 @@ rcancel_test()
974974

975975
main()
976976
{
977-
NODE_UUID=`uuidgen`
977+
NODE_UUID=$(uuidgen)
978978
local rc
979979

980980
echo "*********************************************************"

m0t1fs/linux_kernel/st/m0t1fs_server.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
usage()
2323
{
24-
echo "Usage: `basename $0` <start|stop> [server_nid]"
24+
echo "Usage: $(basename $0) <start|stop> [server_nid]"
2525
echo "Please provide the server endpoint address you want to use."
2626
echo "e.g. 192.168.172.130@tcp"
2727
echo "If you want to use the default nid registered for lnet, then do"
28-
echo "`basename $0` start default"
28+
echo "$(basename $0) start default"
2929
}
3030

3131
if [ $# -lt 1 ]
@@ -39,9 +39,9 @@ if [ "x$1" = "x-h" ]; then
3939
exit 0
4040
fi
4141

42-
. `dirname $0`/common.sh
43-
. `dirname $0`/m0t1fs_common_inc.sh
44-
. `dirname $0`/m0t1fs_server_inc.sh
42+
. $(dirname $0)/common.sh
43+
. $(dirname $0)/m0t1fs_common_inc.sh
44+
. $(dirname $0)/m0t1fs_server_inc.sh
4545

4646
main()
4747
{

m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ mkiosloopdevs()
8989
cat > disks.conf << EOF
9090
Device:
9191
- id: $ADEV_ID
92-
filename: `pwd`/$ADEV_ID$adisk
92+
filename: $(pwd)/$ADEV_ID$adisk
9393
EOF
9494

9595
dev_end=$(($DDEV_ID + $nr_devs))

m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ wait_for_sns_repair_or_rebalance_not_4()
267267
repair_status="$M0_SRC_DIR/sns/cm/st/m0repair -O $op -t 0 -C ${lnet_nid}:${SNS_QUIESCE_CLI_EP} $ios_eps_not_4"
268268

269269
echo $repair_status
270-
status=`eval $repair_status`
270+
status=$(eval $repair_status)
271271
rc=$?
272272
if [ $rc != 0 ]; then
273273
echo "SNS Repair status query failed"
@@ -290,7 +290,7 @@ wait_for_sns_repair_or_rebalance()
290290
sleep 5
291291
repair_status="$M0_SRC_DIR/sns/cm/st/m0repair -O $op -t 0 -C ${lnet_nid}:${SNS_QUIESCE_CLI_EP} $ios_eps"
292292
echo $repair_status
293-
status=`eval $repair_status`
293+
status=$(eval $repair_status)
294294
rc=$?
295295
if [ $rc != 0 ]; then
296296
echo "SNS Repair status query failed"
@@ -301,7 +301,7 @@ wait_for_sns_repair_or_rebalance()
301301
break;
302302
done
303303

304-
op=`echo $status | grep status=3`
304+
op=$(echo $status | grep status=3)
305305
[[ ! -z "$op" ]] && return 1
306306

307307
return 0
@@ -442,7 +442,7 @@ kill_ios4_ioservice()
442442
{
443443
echo "finding ios4 ..."
444444
echo pgrep -fn ${prog_exec}.+${IOSEP[3]}
445-
ios4_pid=`pgrep -fn ${prog_exec}.+${IOSEP[3]}`
445+
ios4_pid=$(pgrep -fn ${prog_exec}.+${IOSEP[3]})
446446
echo === pid of ios4: $ios4_pid ===
447447
kill -KILL $ios4_pid >/dev/null 2>&1
448448
echo "finding ios4 again..."

m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1f.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#
2020

2121

22-
. `dirname $0`/common.sh
23-
. `dirname $0`/m0t1fs_common_inc.sh
24-
. `dirname $0`/m0t1fs_client_inc.sh
25-
. `dirname $0`/m0t1fs_server_inc.sh
26-
. `dirname $0`/m0t1fs_sns_common_inc.sh
22+
. $(dirname $0)/common.sh
23+
. $(dirname $0)/m0t1fs_common_inc.sh
24+
. $(dirname $0)/m0t1fs_client_inc.sh
25+
. $(dirname $0)/m0t1fs_server_inc.sh
26+
. $(dirname $0)/m0t1fs_sns_common_inc.sh
2727

2828
###################################################
2929
# SNS repair is only supported in COPYTOOL mode,
@@ -169,7 +169,7 @@ main()
169169

170170
sandbox_init
171171

172-
NODE_UUID=`uuidgen`
172+
NODE_UUID=$(uuidgen)
173173
local multiple_pools=0
174174
motr_service start $multiple_pools $stride $N $K $S $P || {
175175
echo "Failed to start Motr Service."

m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1k_1f.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#
2020

2121

22-
. `dirname $0`/common.sh
23-
. `dirname $0`/m0t1fs_common_inc.sh
24-
. `dirname $0`/m0t1fs_client_inc.sh
25-
. `dirname $0`/m0t1fs_server_inc.sh
26-
. `dirname $0`/m0t1fs_sns_common_inc.sh
22+
. $(dirname $0)/common.sh
23+
. $(dirname $0)/m0t1fs_common_inc.sh
24+
. $(dirname $0)/m0t1fs_client_inc.sh
25+
. $(dirname $0)/m0t1fs_server_inc.sh
26+
. $(dirname $0)/m0t1fs_sns_common_inc.sh
2727

2828
###################################################
2929
# SNS repair is only supported in COPYTOOL mode,
@@ -109,7 +109,7 @@ main()
109109

110110
sandbox_init
111111

112-
NODE_UUID=`uuidgen`
112+
NODE_UUID=$(uuidgen)
113113
local multiple_pools=0
114114
motr_service start $multiple_pools $stride $N $K $S $P || {
115115
echo "Failed to start Motr Service."

0 commit comments

Comments
 (0)