fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] common/renameat2: use mktemp(1) to create temporary directory
@ 2021-11-09 17:55 Luís Henriques
  0 siblings, 0 replies; only message in thread
From: Luís Henriques @ 2021-11-09 17:55 UTC (permalink / raw)
  To: fstests; +Cc: Luís Henriques

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")

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-09 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 17:55 [PATCH] common/renameat2: use mktemp(1) to create temporary directory Luís Henriques

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).