Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108677008
D28480.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D28480.diff
View Options
diff --git a/bin/pkill/tests/pgrep-j_test.sh b/bin/pkill/tests/pgrep-j_test.sh
--- a/bin/pkill/tests/pgrep-j_test.sh
+++ b/bin/pkill/tests/pgrep-j_test.sh
@@ -9,7 +9,7 @@
base=pgrep_j_test
-if [ `id -u` -ne 0 ]; then
+if [ "$(id -u)" -ne 0 ]; then
echo "1..0 # skip Test needs uid 0."
exit 0
fi
@@ -28,12 +28,12 @@
command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount &
sleep 0.5
-for i in `seq 1 10`; do
+for i in $(seq 1 10); do
jid1=$(jail_name_to_jid ${base}_1_1)
jid2=$(jail_name_to_jid ${base}_1_2)
jid="${jid1},${jid2}"
case "$jid" in
- [0-9]+,[0-9]+)
+ [0-9]*,[0-9]*)
break
;;
esac
@@ -43,14 +43,14 @@
pid1="$(pgrep -f -x -j "$jid" "$sleep $sleep_amount" | sort)"
pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
- $(cat ${PWD}/${base}_1_2.pid) | sort)
+ "$(cat ${PWD}/${base}_1_2.pid)" | sort)
if [ "$pid1" = "$pid2" ]; then
echo "ok 1 - $name"
else
- echo "not ok 1 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
+ echo "not ok 1 - $name # pgrep output: '$pid1', pidfile output: '$pid2'"
fi
-[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
-[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
+[ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)"
+[ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)"
wait
name="pgrep -j any"
@@ -64,14 +64,14 @@
sleep 2
pid1="$(pgrep -f -x -j any "$sleep $sleep_amount" | sort)"
pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
- $(cat ${PWD}/${base}_2_2.pid) | sort)
+ "$(cat ${PWD}/${base}_2_2.pid)" | sort)
if [ "$pid1" = "$pid2" ]; then
echo "ok 2 - $name"
else
- echo "not ok 2 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
+ echo "not ok 2 - $name # pgrep output: '$pid1', pidfile output: '$pid2'"
fi
-[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
-[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
+[ -f ${PWD}/${base}_2_1.pid ] && kill "$(cat ${PWD}/${base}_2_1.pid)"
+[ -f ${PWD}/${base}_2_2.pid ] && kill "$(cat ${PWD}/${base}_2_2.pid)"
wait
name="pgrep -j none"
@@ -84,10 +84,10 @@
if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then
echo "ok 3 - $name"
else
- echo "not ok 3 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
+ echo "not ok 3 - $name # pgrep output: '$pid1', pidfile output: '$pid2'"
fi
-[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid)
-[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid)
+[ -f ${PWD}/${base}_3_1.pid ] && kill "$(cat $PWD/${base}_3_1.pid)"
+[ -f ${PWD}/${base}_3_2.pid ] && kill "$(cat $PWD/${base}_3_2.pid)"
wait
# test 4 is like test 1 except with jname instead of jid.
@@ -104,14 +104,14 @@
jname="${base}_4_1,${base}_4_2"
pid1="$(pgrep -f -x -j "$jname" "$sleep $sleep_amount" | sort)"
pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_4_1.pid)" \
- $(cat ${PWD}/${base}_4_2.pid) | sort)
+ "$(cat ${PWD}/${base}_4_2.pid)" | sort)
if [ "$pid1" = "$pid2" ]; then
echo "ok 4 - $name"
else
echo "not ok 4 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
fi
-[ -f ${PWD}/${base}_4_1.pid ] && kill $(cat ${PWD}/${base}_4_1.pid)
-[ -f ${PWD}/${base}_4_2.pid ] && kill $(cat ${PWD}/${base}_4_2.pid)
+[ -f ${PWD}/${base}_4_1.pid ] && kill "$(cat ${PWD}/${base}_4_1.pid)"
+[ -f ${PWD}/${base}_4_2.pid ] && kill "$(cat ${PWD}/${base}_4_2.pid)"
wait
rm -f $sleep
diff --git a/bin/pkill/tests/pkill-j_test.sh b/bin/pkill/tests/pkill-j_test.sh
--- a/bin/pkill/tests/pkill-j_test.sh
+++ b/bin/pkill/tests/pkill-j_test.sh
@@ -9,7 +9,7 @@
base=pkill_j_test
-if [ `id -u` -ne 0 ]; then
+if [ "$(id -u)" -ne 0 ]; then
echo "1..0 # skip Test needs uid 0."
exit 0
fi
@@ -29,28 +29,31 @@
$sleep $sleep_amount &
-for i in `seq 1 10`; do
+for i in $(seq 1 10); do
jid1=$(jail_name_to_jid ${base}_1_1)
jid2=$(jail_name_to_jid ${base}_1_2)
jid="${jid1},${jid2}"
case "$jid" in
- [0-9]+,[0-9]+)
+ [0-9]*,[0-9]*)
break
;;
+ *)
+ echo "Did not match: '${jid}'" >&2
+ ;;
esac
sleep 0.1
done
sleep 0.5
if pkill -f -j "$jid" $sleep && sleep 0.5 &&
- ! -f ${PWD}/${base}_1_1.pid &&
- ! -f ${PWD}/${base}_1_2.pid ; then
+ ! test -f "${PWD}/${base}_1_1.pid" &&
+ ! test -f "${PWD}/${base}_1_2.pid" ; then
echo "ok 1 - $name"
else
echo "not ok 1 - $name"
fi 2>/dev/null
-[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
-[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
+[ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)"
+[ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)"
wait
name="pkill -j any"
@@ -65,14 +68,14 @@
chpid3=$!
sleep 0.5
if pkill -f -j any $sleep && sleep 0.5 &&
- [ ! -f ${PWD}/${base}_2_1.pid -a
- ! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then
+ ! test -f ${PWD}/${base}_2_1.pid &&
+ ! test -f ${PWD}/${base}_2_2.pid && kill $chpid3; then
echo "ok 2 - $name"
else
echo "not ok 2 - $name"
fi 2>/dev/null
-[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
-[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
+[ -f ${PWD}/${base}_2_1.pid ] && kill "$(cat ${PWD}/${base}_2_1.pid)"
+[ -f ${PWD}/${base}_2_2.pid ] && kill "$(cat ${PWD}/${base}_2_2.pid)"
wait
name="pkill -j none"
@@ -88,8 +91,8 @@
ls ${PWD}/*.pid
echo "not ok 3 - $name"
fi 2>/dev/null
-[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid)
-[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid)
+[ -f ${PWD}/${base}_3_1.pid ] && kill "$(cat ${base}_3_1.pid)"
+[ -f ${PWD}/${base}_3_2.pid ] && kill "$(cat ${base}_3_2.pid)"
wait
# test 4 is like test 1 except with jname instead of jid.
@@ -107,14 +110,14 @@
jname="${base}_4_1,${base}_4_2"
if pkill -f -j "$jname" $sleep && sleep 0.5 &&
- ! -f ${PWD}/${base}_4_1.pid &&
- ! -f ${PWD}/${base}_4_2.pid ; then
+ ! test -f ${PWD}/${base}_4_1.pid &&
+ ! test -f ${PWD}/${base}_4_2.pid ; then
echo "ok 4 - $name"
else
echo "not ok 4 - $name"
fi 2>/dev/null
-[ -f ${PWD}/${base}_4_1.pid ] && kill $(cat ${PWD}/${base}_4_1.pid)
-[ -f ${PWD}/${base}_4_2.pid ] && kill $(cat ${PWD}/${base}_4_2.pid)
+[ -f ${PWD}/${base}_4_1.pid ] && kill "$(cat ${PWD}/${base}_4_1.pid)"
+[ -f ${PWD}/${base}_4_2.pid ] && kill "$(cat ${PWD}/${base}_4_2.pid)"
wait
rm -f $sleep
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 28, 6:10 AM (3 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16254603
Default Alt Text
D28480.diff (6 KB)
Attached To
Mode
D28480: bin/pkill: Fix {pgrep,pkill}-j_test.sh
Attached
Detach File
Event Timeline
Log In to Comment