diff mbox series

fstests: common/btrfs: use complete sub command

Message ID 20200210031322.1177-1-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series fstests: common/btrfs: use complete sub command | expand

Commit Message

Anand Jain Feb. 10, 2020, 3:13 a.m. UTC
Grep failed to find this subcommand of btrfs, leading to a wrong
inference for a moment.

Make sure we use the full subcommand name in the btrfs command.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 common/btrfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcos Paulo de Souza Feb. 10, 2020, 12:03 p.m. UTC | #1
On Mon, 2020-02-10 at 11:13 +0800, Anand Jain wrote:
> Grep failed to find this subcommand of btrfs, leading to a wrong
> inference for a moment.
> 
> Make sure we use the full subcommand name in the btrfs command.

Well, I don't see how this could fail, but IMHO I like to see these
commands written in full rather than using contracted names.

> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Marcos Paulo de Souza <mpdesouza@suse.com>


> ---
>  common/btrfs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index 19ac7cc4b18c..33ad7e3b41cc 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -7,7 +7,7 @@ _btrfs_get_subvolid()
>  	mnt=$1
>  	name=$2
>  
> -	$BTRFS_UTIL_PROG sub list $mnt | grep $name | awk '{ print $2
> }'
> +	$BTRFS_UTIL_PROG subvolume list $mnt | grep $name | awk '{
> print $2 }'
>  }
>  
>  # _require_btrfs_command <command> [<subcommand>|<option>]
Nikolay Borisov Feb. 10, 2020, 3:52 p.m. UTC | #2
On 10.02.20 г. 5:13 ч., Anand Jain wrote:
> Grep failed to find this subcommand of btrfs, leading to a wrong
> inference for a moment.
> 
> Make sure we use the full subcommand name in the btrfs command.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

NAK.

It's not entirely clearly what this patch fixes, since grep doesn't
interact with the subcomand at all, it interacts with its result.
Furthermore command expansion is performed by btrfs-completion script so
fixes about command expansion should go there.
> ---
>  common/btrfs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index 19ac7cc4b18c..33ad7e3b41cc 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -7,7 +7,7 @@ _btrfs_get_subvolid()
>  	mnt=$1
>  	name=$2
>  
> -	$BTRFS_UTIL_PROG sub list $mnt | grep $name | awk '{ print $2 }'
> +	$BTRFS_UTIL_PROG subvolume list $mnt | grep $name | awk '{ print $2 }'
>  }
>  
>  # _require_btrfs_command <command> [<subcommand>|<option>]
>
Anand Jain Feb. 11, 2020, 12:45 a.m. UTC | #3
On 2/10/20 8:03 PM, Marcos Paulo de Souza wrote:
> On Mon, 2020-02-10 at 11:13 +0800, Anand Jain wrote:
>> Grep failed to find this subcommand of btrfs, leading to a wrong
>> inference for a moment.
>>
>> Make sure we use the full subcommand name in the btrfs command.
> 
> Well, I don't see how this could fail,

Its about searching for the subvolume sub-command in the file common/btrfs.

I hope this clarifies. Change log is updated in v2.
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index 19ac7cc4b18c..33ad7e3b41cc 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -7,7 +7,7 @@  _btrfs_get_subvolid()
 	mnt=$1
 	name=$2
 
-	$BTRFS_UTIL_PROG sub list $mnt | grep $name | awk '{ print $2 }'
+	$BTRFS_UTIL_PROG subvolume list $mnt | grep $name | awk '{ print $2 }'
 }
 
 # _require_btrfs_command <command> [<subcommand>|<option>]