NACK: [act][PATCH] UBUNTU: SAUCE: ubuntu_btrfs_kernel_fixes: fix "if" statement

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Mon Sep 16 14:04:03 UTC 2019


On Mon, Sep 16, 2019 at 09:54:45PM +0800, Wen-chien Jesse Sung wrote:
> 
> BugLink: https://launchpad.net/bugs/1813534
> 
> The test complains about "line 58: [: -gt: unary operator expected".
> 
> Signed-off-by: Wen-chien Jesse Sung <jesse.sung at canonical.com>
> ---
>  .../fixes/b9a8cc5bef963b76c5b6c3016b7e91988a3e758b.sh           | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

> diff --git a/ubuntu_btrfs_kernel_fixes/fixes/b9a8cc5bef963b76c5b6c3016b7e91988a3e758b.sh b/ubuntu_btrfs_kernel_fixes/fixes/b9a8cc5bef963b76c5b6c3016b7e91988a3e758b.sh
> index c3bd6a7..9513f69 100755
> --- a/ubuntu_btrfs_kernel_fixes/fixes/b9a8cc5bef963b76c5b6c3016b7e91988a3e758b.sh
> +++ b/ubuntu_btrfs_kernel_fixes/fixes/b9a8cc5bef963b76c5b6c3016b7e91988a3e758b.sh
> @@ -55,7 +55,7 @@ wait $pid
>  
>  umount $DEV0
>  n=$(btrfsck $DEV0 | grep "errors")
> -if [ $n -gt 0 ]; then
> +if [[ $n -gt 0 ]]; then

I think the problem here is that it should be 'grep -c "errors"' instead.

Otherwise, this will fail to catch errors as [ "errors" -gt 0 ] test fail, when
we want that to succeed whenever we find "errors" on the output of btrfsck.

Cascardo.

>  	echo "failed, btrfsck found some errors"
>  	rc=1
>  else



More information about the kernel-team mailing list