linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly
@ 2013-02-26 20:42 Eric Sandeen
  2013-03-05 20:23 ` Rich Johnston
  2013-03-05 22:41 ` [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present Eric Sandeen
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2013-02-26 20:42 UTC (permalink / raw)
  To: xfs-oss, linux-btrfs, Stefan Behrens

I added an "-f" option to mkfs.btrfs to force overwrite
of an existing filesystem.  Now on an xfstests run, new
mkfs.btrfs requires it, and old mkfs.btrfs cannot accept
it.

So, add a helper which works out whether -f is needed,
and add it to the MKFS_BTRFS_PROG env. var as necessary,
so that it is an always-included option during the tests.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/common.config b/common.config
index 57f505d..9f1d309 100644
--- a/common.config
+++ b/common.config
@@ -101,6 +101,17 @@ set_prog_path()
     return 1
 }
 
+# Handle mkfs.btrfs which does (or does not) require -f to overwrite
+set_btrfs_mkfs_prog_path_with_opts()
+{
+	p=`set_prog_path mkfs.btrfs`
+	if grep -q 'force overwrite' $p; then
+		echo "$p -f"
+	else
+		echo $p
+	fi
+}
+
 _fatal()
 {
     echo "$*"
@@ -185,7 +196,7 @@ case "$HOSTOS" in
     Linux)
         export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_prog_path mkfs.btrfs`"
+        export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
         export MKFS_NFS_PROG="false"


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly
  2013-02-26 20:42 [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly Eric Sandeen
@ 2013-03-05 20:23 ` Rich Johnston
  2013-03-05 22:41 ` [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present Eric Sandeen
  1 sibling, 0 replies; 5+ messages in thread
From: Rich Johnston @ 2013-03-05 20:23 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss, linux-btrfs, Stefan Behrens

Looks good.

Reviewed-by: Rich Johnston <rjohnston@sgi.com>

This patch has been committed.

Thanks
--Rich

commit 24fef70ef3fa0be047264b7a40b0bcf86533ec22
Author: Eric Sandeen <sandeen@redhat.com>
Date:   Tue Feb 26 20:42:38 2013 +0000

     xfstests: handle new mkfs.btrfs -f option cleanly

     I added an "-f" option to mkfs.btrfs to force overwrite
     of an existing filesystem.  Now on an xfstests run, new
     mkfs.btrfs requires it, and old mkfs.btrfs cannot accept
     it.

     So, add a helper which works out whether -f is needed,
     and add it to the MKFS_BTRFS_PROG env. var as necessary,
     so that it is an always-included option during the tests.

     Signed-off-by: Eric Sandeen <sandeen@redhat.com>
     Reviewed-by: Rich Johnston <rjohnston@sgi.com>
     Signed-off-by: Rich Johnston <rjohnston@sgi.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present
  2013-02-26 20:42 [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly Eric Sandeen
  2013-03-05 20:23 ` Rich Johnston
@ 2013-03-05 22:41 ` Eric Sandeen
  2013-03-05 22:47   ` Rich Johnston
  2013-03-06 13:03   ` Rich Johnston
  1 sibling, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2013-03-05 22:41 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss, linux-btrfs, Stefan Behrens

My earlier patch (xfstests: handle new mkfs.btrfs -f option cleanly)
had a flaw in that if set_prog_path mkfs.btrfs returns nothing,
the grep will hang.

Test for that case to avoid it, and just return the empty string
in that case.

Reported-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/common.config b/common.config
index c10163a..a0b017d 100644
--- a/common.config
+++ b/common.config
@@ -108,7 +108,7 @@ set_prog_path()
 set_btrfs_mkfs_prog_path_with_opts()
 {
 	p=`set_prog_path mkfs.btrfs`
-	if grep -q 'force overwrite' $p; then
+	if [ "$p" != "" ] && grep -q 'force overwrite' $p; then
 		echo "$p -f"
 	else
 		echo $p



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present
  2013-03-05 22:41 ` [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present Eric Sandeen
@ 2013-03-05 22:47   ` Rich Johnston
  2013-03-06 13:03   ` Rich Johnston
  1 sibling, 0 replies; 5+ messages in thread
From: Rich Johnston @ 2013-03-05 22:47 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, Stefan Behrens, linux-btrfs, xfs-oss

Yup looks good, thanks for fixing it Eric.

Reviewed-by: Rich Johnston <rjohnston@sgi.com>

Having some network issues, will pull this in tomorrow.

Thanks
--Rich

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present
  2013-03-05 22:41 ` [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present Eric Sandeen
  2013-03-05 22:47   ` Rich Johnston
@ 2013-03-06 13:03   ` Rich Johnston
  1 sibling, 0 replies; 5+ messages in thread
From: Rich Johnston @ 2013-03-06 13:03 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, Stefan Behrens, linux-btrfs, xfs-oss

This patch has been committed.

Thanks
--Rich

commit 52f4953ac4a377f9f7fc870d2a81f30c3e5d3c7f
Author: Eric Sandeen <sandeen@sandeen.net>
Date:   Tue Mar 5 22:41:54 2013 +0000

     xfstests: Fix hang when mkfs.btrfs isn't present

     My earlier patch (xfstests: handle new mkfs.btrfs -f option cleanly)
     had a flaw in that if set_prog_path mkfs.btrfs returns nothing,
     the grep will hang.

     Test for that case to avoid it, and just return the empty string
     in that case.

     Reported-by: Rich Johnston <rjohnston@sgi.com>
     Signed-off-by: Eric Sandeen <sandeen@redhat.com>
     Reviewed-by: Rich Johnston <rjohnston@sgi.com>
     Signed-off-by: Rich Johnston <rjohnston@sgi.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-06 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26 20:42 [PATCH] xfstests: handle new mkfs.btrfs -f option cleanly Eric Sandeen
2013-03-05 20:23 ` Rich Johnston
2013-03-05 22:41 ` [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present Eric Sandeen
2013-03-05 22:47   ` Rich Johnston
2013-03-06 13:03   ` Rich Johnston

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