提交 0145b4e1 编写于 作者: S Sascha Silbe 提交者: Max Reitz

qemu-iotests: check: don't place files with predictable names in /tmp

Placing files with predictable or even hard-coded names in /tmp is a
security risk and can prevent or disturb operation on a multi-user
machine. Place them inside the "scratch" directory instead, as we
already do for most other test-related files.
Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
Message-id: 1459848109-29756-2-git-send-email-silbe@linux.vnet.ibm.com
Reviewed-by: NMax Reitz <mreitz@redhat.com>
Signed-off-by: NMax Reitz <mreitz@redhat.com>
上级 c4189d85
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
# Control script for QA # Control script for QA
# #
tmp=/tmp/$$
status=0 status=0
needwrap=true needwrap=true
try=0 try=0
...@@ -130,6 +129,8 @@ fi ...@@ -130,6 +129,8 @@ fi
# exit 1 # exit 1
#fi #fi
tmp="${TEST_DIR}"/$$
_wallclock() _wallclock()
{ {
date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }' date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
...@@ -146,8 +147,8 @@ _wrapup() ...@@ -146,8 +147,8 @@ _wrapup()
# for hangcheck ... # for hangcheck ...
# remove files that were used by hangcheck # remove files that were used by hangcheck
# #
[ -f /tmp/check.pid ] && rm -rf /tmp/check.pid [ -f "${TEST_DIR}"/check.pid ] && rm -rf "${TEST_DIR}"/check.pid
[ -f /tmp/check.sts ] && rm -rf /tmp/check.sts [ -f "${TEST_DIR}"/check.sts ] && rm -rf "${TEST_DIR}"/check.sts
if $showme if $showme
then then
...@@ -197,8 +198,8 @@ END { if (NR > 0) { ...@@ -197,8 +198,8 @@ END { if (NR > 0) {
needwrap=false needwrap=false
fi fi
rm -f /tmp/*.out /tmp/*.err /tmp/*.time rm -f "${TEST_DIR}"/*.out "${TEST_DIR}"/*.err "${TEST_DIR}"/*.time
rm -f /tmp/check.pid /tmp/check.sts rm -f "${TEST_DIR}"/check.pid "${TEST_DIR}"/check.sts
rm -f $tmp.* rm -f $tmp.*
} }
...@@ -208,16 +209,16 @@ trap "_wrapup; exit \$status" 0 1 2 3 15 ...@@ -208,16 +209,16 @@ trap "_wrapup; exit \$status" 0 1 2 3 15
# Save pid of check in a well known place, so that hangcheck can be sure it # Save pid of check in a well known place, so that hangcheck can be sure it
# has the right pid (getting the pid from ps output is not reliable enough). # has the right pid (getting the pid from ps output is not reliable enough).
# #
rm -rf /tmp/check.pid rm -rf "${TEST_DIR}"/check.pid
echo $$ >/tmp/check.pid echo $$ > "${TEST_DIR}"/check.pid
# for hangcheck ... # for hangcheck ...
# Save the status of check in a well known place, so that hangcheck can be # Save the status of check in a well known place, so that hangcheck can be
# sure to know where check is up to (getting test number from ps output is # sure to know where check is up to (getting test number from ps output is
# not reliable enough since the trace stuff has been introduced). # not reliable enough since the trace stuff has been introduced).
# #
rm -rf /tmp/check.sts rm -rf "${TEST_DIR}"/check.sts
echo "preamble" >/tmp/check.sts echo "preamble" > "${TEST_DIR}"/check.sts
# don't leave old full output behind on a clean run # don't leave old full output behind on a clean run
rm -f check.full rm -f check.full
...@@ -285,7 +286,7 @@ do ...@@ -285,7 +286,7 @@ do
rm -f core $seq.notrun rm -f core $seq.notrun
# for hangcheck ... # for hangcheck ...
echo "$seq" >/tmp/check.sts echo "$seq" > "${TEST_DIR}"/check.sts
start=`_wallclock` start=`_wallclock`
$timestamp && echo -n " ["`date "+%T"`"]" $timestamp && echo -n " ["`date "+%T"`"]"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册