Skip to content

Commit

Permalink
CORTX-30751: Codacy code cleanup (Seagate#1606).
Browse files Browse the repository at this point in the history
This patch fixes some of the codacy warnings.
Warning fixed: "Double quote to prevent globing and words splitting."

Signed-off-by: alfhad <fahadshah2411@gmail.com>
Signed-off-by: Rinku Kothiya <rinku.kothiya@seagate.com>
  • Loading branch information
alfhad committed Apr 23, 2022
1 parent 2a23611 commit fcab9c6
Show file tree
Hide file tree
Showing 56 changed files with 1,252 additions and 1,252 deletions.
10 changes: 5 additions & 5 deletions addb2/st/addb2dump-plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
#


SCRIPT_PATH="$(readlink -f $0)"
SCRIPT_PATH="$(readlink -f "$0")"
MOTR_SRC_DIR="${SCRIPT_PATH%/*/*/*}"
UT_SANDBOX_DIR="/var/motr/m0ut/ut-sandbox"
ADDB2_STOB="/var/motr/m0ut/ut-sandbox/__s/o/100000000000000:2"
PLUGIN_SO="${MOTR_SRC_DIR}/addb2/st/.libs/libaddb2dump-plugin-test.so"

. ${MOTR_SRC_DIR}/utils/functions
. "${MOTR_SRC_DIR}"/utils/functions

function check_root() {
[[ $UID -eq 0 ]] || {
Expand All @@ -35,12 +35,12 @@ function check_root() {
}

function generate_addb2_stob() {
${MOTR_SRC_DIR}/utils/m0run -- "m0ut -k -t addb2-storage:write-many" > /dev/null
"${MOTR_SRC_DIR}"/utils/m0run -- "m0ut -k -t addb2-storage:write-many" > /dev/null
}

function dump_addb2_stob() {
ADDB2_DUMP=`${MOTR_SRC_DIR}/utils/m0addb2dump -f -p ${PLUGIN_SO} \
-- ${ADDB2_STOB} | grep "measurement"`
ADDB2_DUMP=`"${MOTR_SRC_DIR}"/utils/m0addb2dump -f -p "${PLUGIN_SO}" \
-- "${ADDB2_STOB}" | grep "measurement"`
}

function delete_ut_sandbox() {
Expand Down
12 changes: 6 additions & 6 deletions cas/st/ctgdump_tesh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ kvs_create_n_insert()
MOTR_PARAM="-l $cli_ep -h $ha_ep -p $PROF_OPT \
-f $M0T1FS_PROC_ID -s "

echo "$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} index create "$DIX_FID"
echo "$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" index create "$DIX_FID"

"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index create "$DIX_FID" \
|| {
rc=$?
echo "m0kv failed"
}

for ((j=0; j<$num_of_kv; j++)); do
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "$key_prefix-$j" "$val_prefix-$j"
done
return $rc
Expand Down Expand Up @@ -95,7 +95,7 @@ ctgdump_comp()
-A linuxstob:addb-stobs -w 4 -m 65536 -q 16 -N 100663296 -C 262144 -K 100663296 \
-k 262144 -c ${dir}/confd/conf.xc -e ${cas_ep} -f ${proc_fid} str ${dix_fid} "
echo "running: $dump_cmd $dump_cmd_args"
$dump_cmd $dump_cmd_args | sort > "$SANDBOX_DIR/ios$i.dump"
$dump_cmd "$dump_cmd_args" | sort > "$SANDBOX_DIR/ios$i.dump"
done

# Compare each dump file
Expand Down Expand Up @@ -140,7 +140,7 @@ ctgdump_test()
}

if [ $rc == 0 ]; then
ctgdump_comp $SANDBOX_DIR ${XPRT}:${lnet_nid}:${IOSEP[0]} ${proc_fid} $DIX_FID
ctgdump_comp "$SANDBOX_DIR" "${XPRT}":"${lnet_nid}":"${IOSEP[0]}" "${proc_fid}" $DIX_FID
rc=$?
fi

Expand All @@ -157,7 +157,7 @@ case "$cmd" in
rc=$?
;;
comp)
ctgdump_comp $2 $3 $4 $5
ctgdump_comp "$2" "$3" "$4" "$5"
rc=$?
;;
*)
Expand Down
28 changes: 14 additions & 14 deletions console/st/console-st.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ umask 0002
## CAUTION: This path will be removed by superuser.
SANDBOX_DIR=${SANDBOX_DIR:-/var/motr/sandbox.console-st}

M0_SRC_DIR=`readlink -f $0`
M0_SRC_DIR=`readlink -f "$0"`
M0_SRC_DIR=${M0_SRC_DIR%/*/*/*}

. $M0_SRC_DIR/utils/functions # die, opcode, sandbox_init, report_and_exit
. "$M0_SRC_DIR"/utils/functions # die, opcode, sandbox_init, report_and_exit

CLIENT=$M0_SRC_DIR/console/m0console
SERVER=$M0_SRC_DIR/console/st/server
Expand All @@ -43,7 +43,7 @@ CONF_FILE_PATH=$M0_SRC_DIR/ut/diter.xc
CONF_PROFILE='<0x7000000000000001:0>'

NODE_UUID=02e94b88-19ab-4166-b26b-91b51f22ad91 # required by `common.sh'
. $M0_SRC_DIR/m0t1fs/linux_kernel/st/common.sh # modload
. "$M0_SRC_DIR"/m0t1fs/linux_kernel/st/common.sh # modload

XPRT=$(m0_default_xprt)

Expand All @@ -66,15 +66,15 @@ start_server()
## registers "ds1" and "ds2" service types, so we do not pass
## these services to m0mkfs.
##
$M0_SRC_DIR/utils/mkfs/m0mkfs -T AD -D console_st_srv.db \
"$M0_SRC_DIR"/utils/mkfs/m0mkfs -T AD -D console_st_srv.db \
-S console_st_srv.stob -A linuxstob:console_st_srv-addb.stob \
-w 10 -e "$XPRT:$SERVER_EP_ADDR" -H $SERVER_EP_ADDR \
-q 2 -m $((1 << 17)) \
-c $CONF_FILE_PATH \
&>$SANDBOX_DIR/mkfs.log || die 'm0mkfs failed'
-c "$CONF_FILE_PATH" \
&>"$SANDBOX_DIR"/mkfs.log || die 'm0mkfs failed'
echo 'OK' >&2

$SERVER -v &>$SANDBOX_DIR/server.log 2>&1 &
$SERVER -v &>"$SANDBOX_DIR"/server.log 2>&1 &
SERVERPID=$!
sleep 1
pgrep $(basename "$SERVER") >/dev/null || die 'Service failed to start'
Expand All @@ -83,7 +83,7 @@ start_server()

create_yaml_files()
{
cat <<EOF >$YAML_FILE9
cat <<EOF >"$YAML_FILE9"
server : $SERVER_EP_ADDR
client : $CLIENT_EP_ADDR
Expand All @@ -98,7 +98,7 @@ EOF

## The content of `Write FOP' below should correspond to
## m0_fop_cob_writev definition (see ioservice/io_fops.h).
cat <<EOF >$YAML_FILE41
cat <<EOF >"$YAML_FILE41"
server : $SERVER_EP_ADDR
client : $CLIENT_EP_ADDR
Expand Down Expand Up @@ -144,7 +144,7 @@ stop_server()
check_reply()
{
expected="$1"
actual=`awk '/replied/ {print $5}' $OUTPUT_FILE`
actual=`awk '/replied/ {print $5}' "$OUTPUT_FILE"`
[ -z "$actual" ] && die 'Reply not found'
[ "$actual" -eq "$expected" ] || die 'Invalid reply'
}
Expand All @@ -157,8 +157,8 @@ test_fop()
local reply="$1"; shift

echo -n "$message: " >&2
$CLIENT -f $request -v "$@" | tee $OUTPUT_FILE
check_reply $reply
$CLIENT -f "$request" -v "$@" | tee "$OUTPUT_FILE"
check_reply "$reply"
echo OK >&2
}

Expand All @@ -172,7 +172,7 @@ run_st()

test_fop 'Console test fop, YAML input' \
$(opcode M0_CONS_TEST) $(opcode M0_CONS_FOP_REPLY_OPCODE) \
-i -y $YAML_FILE9
-i -y "$YAML_FILE9"

## This test case does not work: $SERVER crashes while
## processing the fop (m0_fop_cob_writev).
Expand All @@ -181,7 +181,7 @@ run_st()
test_fop 'Write request fop' \
$(opcode M0_IOSERVICE_WRITEV_OPCODE) \
$(opcode M0_IOSERVICE_WRITEV_REP_OPCODE) \
-i -y $YAML_FILE41
-i -y "$YAML_FILE41"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion dix/cm/st/m0t1fs_dix_repair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ main()

NODE_UUID=`uuidgen`
local multiple_pools=0
motr_service start $multiple_pools $stride $N $K $S $P || {
motr_service start $multiple_pools "$stride" "$N" "$K" "$S" "$P" || {
echo "Failed to start Motr Service."
return 1
}
Expand Down
2 changes: 1 addition & 1 deletion dix/cm/st/m0t1fs_dix_repair_quiesce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ main()

NODE_UUID=$(uuidgen)
local multiple_pools=0
motr_service start $multiple_pools $stride $N $K $S $P || {
motr_service start $multiple_pools "$stride" "$N" "$K" "$S" "$P" || {
echo "Failed to start Motr Service."
return 1
}
Expand Down
22 changes: 11 additions & 11 deletions fdmi/plugins/fdmi_plugin_st.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ do_some_kv_operations()
-f $M0T1FS_PROC_ID -s "

echo "Let's create an index and put {somekey:somevalue}"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index create "$DIX_FID" \
put "$DIX_FID" "somekey" "somevalue" \
get "$DIX_FID" "somekey" \
Expand All @@ -69,7 +69,7 @@ do_some_kv_operations()
if $interactive ; then echo "Press Enter to go ..." && read; fi

echo "Let's put {key1: ***}"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "key1" "something1 anotherstring2 YETanotherstring3" \
get "$DIX_FID" "key1" \
|| {
Expand All @@ -79,7 +79,7 @@ do_some_kv_operations()
if $interactive ; then echo "Press Enter to go ..." && read; fi

echo "Let's put {key2: ***}"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "key2" "something1_anotherstring2*YETanotherstring3" \
get "$DIX_FID" "key2" \
|| {
Expand All @@ -103,7 +103,7 @@ do_some_kv_operations()
rc=0

echo "Let's put {key3: ***}"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "key3" "{Bucket-Name:SomeBucket, Object-Name:Someobject, x-amz-meta-replication:Pending}" \
get "$DIX_FID" "key3" \
|| {
Expand All @@ -117,13 +117,13 @@ do_some_kv_operations()
echo "will trigger failure handling"
for ((j=0; j<10; j++)); do
echo "j=$j"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "iter-äää-$j" "something1_anotherstring2*YETanotherstring3-$j"
done
if $interactive ; then echo "Press Enter to go ..." && read; fi

echo "Now, let's delete 'key2' from this index. The plugin must show the del op coming"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM} " \
index del "$DIX_FID" "key2" \
|| {
rc=$?
Expand All @@ -132,7 +132,7 @@ do_some_kv_operations()
if $interactive ; then echo "Press Enter to go ..." && read; fi

echo "Now, let's get 'key2' from this index again. It should fail."
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index get "$DIX_FID" "key2" \
&& {
rc=22 # EINVAL to indicate the test is failed
Expand All @@ -143,7 +143,7 @@ do_some_kv_operations()
sleep 1
echo "Now, let's delete 'key2' from this index again."
echo "It should fail, and the plugin must NOT show the del op coming."
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index del "$DIX_FID" "key2" \
&& {
rc=22 # EINVAL to indicate the test is failed
Expand All @@ -160,7 +160,7 @@ do_some_kv_operations()
echo "will trigger failure handling"
for ((j=0; j<4; j++)); do
echo "a second time j=$j"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "iter-äää-2-$j" "something1_anotherstring2*YETanotherstring3-$j"
done
if $interactive ; then echo "Press Enter to go ..." && read; fi
Expand All @@ -180,7 +180,7 @@ do_some_kv_operations()
echo "will work as normal"
for ((j=0; j<4; j++)); do
echo "back j=$j"
"$M0_SRC_DIR/utils/m0kv" ${MOTR_PARAM} \
"$M0_SRC_DIR/utils/m0kv" "${MOTR_PARAM}" \
index put "$DIX_FID" "iter-äää-3-$j" "something1_anotherstring2*YETanotherstring3-$j"
done
if $interactive ; then echo "Press Enter to go ..." && read; fi
Expand Down Expand Up @@ -215,7 +215,7 @@ start_fdmi_plugin()

if $interactive ; then
echo "Please use another terminal and run this command:"
echo sudo ${PLUGIN_CMD}
echo sudo "${PLUGIN_CMD}"
echo "Then switch back to this terminal and press ENTER"
read
else
Expand Down
8 changes: 4 additions & 4 deletions fdmi/st/echo/echo_plugin_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

#set -x

ECHO_DIR=`dirname $0`
ECHO_DIR=`dirname "$0"`
SRC_DIR=$ECHO_DIR/../../..

$SRC_DIR/m0t1fs/linux_kernel/st/st insmod
$ECHO_DIR/m0fdmiecho
$SRC_DIR/m0t1fs/linux_kernel/st/st rmmod
"$SRC_DIR"/m0t1fs/linux_kernel/st/st insmod
"$ECHO_DIR"/m0fdmiecho
"$SRC_DIR"/m0t1fs/linux_kernel/st/st rmmod
Loading

0 comments on commit fcab9c6

Please sign in to comment.