xfs
[Top] [All Lists]

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

To: Eric Sandeen <sandeen@xxxxxxxxxx>
Subject: [PATCH] xfstests: Fix hang when mkfs.btrfs isn't present
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 05 Mar 2013 16:41:54 -0600
Cc: xfs-oss <xfs@xxxxxxxxxxx>, linux-btrfs <linux-btrfs@xxxxxxxxxxxxxxx>, Stefan Behrens <sbehrens@xxxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <512D1E3E.9050907@xxxxxxxxxx>
References: <512D1E3E.9050907@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130216 Thunderbird/17.0.3
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@xxxxxxx>
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

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


<Prev in Thread] Current Thread [Next in Thread>