diff mbox

[3/3] common: remove tmp.mkfs[err/std] files by name

Message ID 20170112171849.10784-3-ddiss@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

David Disseldorp Jan. 12, 2017, 5:18 p.m. UTC
Without any $tmp suffix, users silly enough to run xfstests without
mktemp present will unintentionally "rm -f *".

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 common/rc  | 2 +-
 common/xfs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Eryu Guan Jan. 13, 2017, 4:24 a.m. UTC | #1
On Thu, Jan 12, 2017 at 06:18:49PM +0100, David Disseldorp wrote:
> Without any $tmp suffix, users silly enough to run xfstests without
> mktemp present will unintentionally "rm -f *".

mktemp creates a file too, removing $tmp.xxx files won't remove $tmp
file itself. So along with removing them by name, I'm thinking about
initializing tmp with /tmp/$$._mkfs (or something like that) as well.

I have another tmp file cleanup patch[1] pending in the list, would you
like to do all the cleanup fix in your patch? Or I can fold your patch
to mine and send out v3.

Thanks,
Eryu

[1] http://www.spinics.net/lists/fstests/msg04953.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Disseldorp Jan. 13, 2017, 10:11 a.m. UTC | #2
On Fri, 13 Jan 2017 12:24:04 +0800, Eryu Guan wrote:

> On Thu, Jan 12, 2017 at 06:18:49PM +0100, David Disseldorp wrote:
> > Without any $tmp suffix, users silly enough to run xfstests without
> > mktemp present will unintentionally "rm -f *".  
> 
> mktemp creates a file too, removing $tmp.xxx files won't remove $tmp
> file itself. So along with removing them by name, I'm thinking about
> initializing tmp with /tmp/$$._mkfs (or something like that) as well.

Oh, yes I missed the extra $tmp rm parameter.

> I have another tmp file cleanup patch[1] pending in the list, would you
> like to do all the cleanup fix in your patch? Or I can fold your patch
> to mine and send out v3.

Please fold it into your patchset.

Cheers, David
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/rc b/common/rc
index 37d0fc8..4cbe00f 100644
--- a/common/rc
+++ b/common/rc
@@ -464,7 +464,7 @@  _scratch_do_mkfs()
 	cat $tmp.mkfsstd
 	eval "cat $tmp.mkfserr | $mkfs_filter" >&2
 
-	rm -f $tmp*
+	rm -f $tmp.mkfsstd $tmp.mkfserr
 	return $mkfs_status
 }
 
diff --git a/common/xfs b/common/xfs
index 767a481..582fcbe 100644
--- a/common/xfs
+++ b/common/xfs
@@ -104,7 +104,7 @@  _scratch_mkfs_xfs()
 	# output mkfs stdout and stderr
 	cat $tmp.mkfsstd
 	cat $tmp.mkfserr >&2
-	rm -f $tmp*
+	rm -f $tmp.mkfsstd $tmp.mkfserr
 
 	return $mkfs_status
 }