fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luís Henriques" <lhenriques@suse.de>
To: fstests@vger.kernel.org
Cc: "Luís Henriques" <lhenriques@suse.de>
Subject: [PATCH] common/renameat2: use mktemp(1) to create temporary directory
Date: Tue,  9 Nov 2021 17:55:55 +0000	[thread overview]
Message-ID: <20211109175555.16795-1-lhenriques@suse.de> (raw)

Instead of using $TEST_DIR/$$, use the _correct_ way to create temporary
directories.  I've seen generic/626 failing with:

  QA output created by 626
  mkdir: cannot create directory '/media/test/471': File exists
  Silence is golden

which was likely due to another test that used the same directory name and
didn't do the clean-up.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
---
 common/renameat2 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/renameat2 b/common/renameat2
index 4d25d7cebf94..9737dff54a2b 100644
--- a/common/renameat2
+++ b/common/renameat2
@@ -105,14 +105,13 @@ _rename_tests()
 _require_renameat2()
 {
 	local flags=$1
-	local rename_dir=$TEST_DIR/$$
+	local rename_dir=`mktemp -d -p $TEST_DIR`
 	local cmd=""
 
 	if test ! -x $here/src/renameat2; then
 		_notrun "renameat2 binary not found"
 	fi
 
-	mkdir $rename_dir
 	touch $rename_dir/foo
 	case $flags in
 	"noreplace")

                 reply	other threads:[~2021-11-09 17:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211109175555.16795-1-lhenriques@suse.de \
    --to=lhenriques@suse.de \
    --cc=fstests@vger.kernel.org \
    /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).