From: Sascha Silbe <silbe@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Kevin Wolf <kwolf@redhat.com>
Cc: Tu Bo <tubo@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 1/7] qemu-iotests: check: don't place files with predictable names in /tmp
Date: Tue, 5 Apr 2016 11:21:43 +0200 [thread overview]
Message-ID: <1459848109-29756-2-git-send-email-silbe@linux.vnet.ibm.com> (raw)
In-Reply-To: <1459848109-29756-1-git-send-email-silbe@linux.vnet.ibm.com>
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: Sascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: Bo Tu <tubo@linux.vnet.ibm.com>
---
tests/qemu-iotests/check | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index c350f16..4cba215 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -19,7 +19,6 @@
# Control script for QA
#
-tmp=/tmp/$$
status=0
needwrap=true
try=0
@@ -130,6 +129,8 @@ fi
# exit 1
#fi
+tmp="${TEST_DIR}"/$$
+
_wallclock()
{
date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
@@ -146,8 +147,8 @@ _wrapup()
# for hangcheck ...
# remove files that were used by hangcheck
#
- [ -f /tmp/check.pid ] && rm -rf /tmp/check.pid
- [ -f /tmp/check.sts ] && rm -rf /tmp/check.sts
+ [ -f "${TEST_DIR}"/check.pid ] && rm -rf "${TEST_DIR}"/check.pid
+ [ -f "${TEST_DIR}"/check.sts ] && rm -rf "${TEST_DIR}"/check.sts
if $showme
then
@@ -197,8 +198,8 @@ END { if (NR > 0) {
needwrap=false
fi
- rm -f /tmp/*.out /tmp/*.err /tmp/*.time
- rm -f /tmp/check.pid /tmp/check.sts
+ rm -f "${TEST_DIR}"/*.out "${TEST_DIR}"/*.err "${TEST_DIR}"/*.time
+ rm -f "${TEST_DIR}"/check.pid "${TEST_DIR}"/check.sts
rm -f $tmp.*
}
@@ -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
# has the right pid (getting the pid from ps output is not reliable enough).
#
-rm -rf /tmp/check.pid
-echo $$ >/tmp/check.pid
+rm -rf "${TEST_DIR}"/check.pid
+echo $$ > "${TEST_DIR}"/check.pid
# for hangcheck ...
# 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
# not reliable enough since the trace stuff has been introduced).
#
-rm -rf /tmp/check.sts
-echo "preamble" >/tmp/check.sts
+rm -rf "${TEST_DIR}"/check.sts
+echo "preamble" > "${TEST_DIR}"/check.sts
# don't leave old full output behind on a clean run
rm -f check.full
@@ -285,7 +286,7 @@ do
rm -f core $seq.notrun
# for hangcheck ...
- echo "$seq" >/tmp/check.sts
+ echo "$seq" > "${TEST_DIR}"/check.sts
start=`_wallclock`
$timestamp && echo -n " ["`date "+%T"`"]"
--
1.9.1
next prev parent reply other threads:[~2016-04-05 9:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 9:21 [Qemu-devel] [PATCH 0/7] next round of qemu-iotests fixes Sascha Silbe
2016-04-05 9:21 ` Sascha Silbe [this message]
2016-04-06 15:36 ` [Qemu-devel] [Qemu-block] [PATCH 1/7] qemu-iotests: check: don't place files with predictable names in /tmp Max Reitz
2016-04-07 19:54 ` Sascha Silbe
2016-04-05 9:21 ` [Qemu-devel] [PATCH 2/7] qemu-iotests: fix 051 on non-PC architectures Sascha Silbe
2016-04-06 15:43 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-05 9:21 ` [Qemu-devel] [PATCH 3/7] qemu-iotests: iotests.VM: remove qtest socket on error Sascha Silbe
2016-04-06 15:55 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-07 19:58 ` Sascha Silbe
2016-04-05 9:21 ` [Qemu-devel] [PATCH 4/7] qemu-iotests: 148: properly skip test if quorum support is missing Sascha Silbe
2016-04-06 16:04 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-05 9:21 ` [Qemu-devel] [PATCH 5/7] qemu-iotests: 068: don't require KVM Sascha Silbe
2016-04-06 16:12 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-05 9:21 ` [Qemu-devel] [PATCH 6/7] qemu-iotests: 141: reduce likelihood of race condition on systems with fast IO Sascha Silbe
2016-04-06 16:15 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-06 16:30 ` Kevin Wolf
2016-04-07 20:27 ` Sascha Silbe
2016-04-08 11:11 ` Kevin Wolf
2016-04-08 12:01 ` Sascha Silbe
2016-04-08 12:31 ` Kevin Wolf
2016-04-08 13:46 ` Sascha Silbe
2016-04-05 9:21 ` [Qemu-devel] [PATCH 7/7] qemu-iotests: iotests.py: get rid of __all__ Sascha Silbe
2016-04-06 16:18 ` [Qemu-devel] [Qemu-block] " Max Reitz
2016-04-08 14:49 ` [Qemu-devel] [Qemu-block] [PATCH 0/7] next round of qemu-iotests fixes Max Reitz
2016-04-08 17:17 ` Sascha Silbe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459848109-29756-2-git-send-email-silbe@linux.vnet.ibm.com \
--to=silbe@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=tubo@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).