All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Dennis Zhou <dennis@kernel.org>
Cc: fstests@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] common/rc: fix device size parser
Date: Mon, 16 Dec 2019 00:40:09 +0800	[thread overview]
Message-ID: <20191215164007.GC1776323@desktop> (raw)
In-Reply-To: <20191211201830.18911-1-dennis@kernel.org>

On Wed, Dec 11, 2019 at 12:18:30PM -0800, Dennis Zhou wrote:
> If you have multiple devices that share the same regex (eg dm-1, dm10),
> then _get_device_size() can return "$size\n$size" which causes the
> following error for btrfs/011.
> 
>     QA output created by 011
>     ./common/rc: line 3084: [: too many arguments
> 
> So, fix this by making grep check against eol.
> 
> Signed-off-by: Dennis Zhou <dennis@kernel.org>
> ---
>  common/rc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index 5cdd829b..b819ede1 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3583,7 +3583,7 @@ _get_available_space()
>  # return device size in kb
>  _get_device_size()
>  {
> -	grep `_short_dev $1` /proc/partitions | awk '{print $3}'
> +	grep "$(_short_dev $1)\$" /proc/partitions | awk '{print $3}'

I changed it to use "grep -w", which seems simpler.

Thanks,
Eryu

>  }
>  
>  # Make sure we actually have dmesg checking set up.
> -- 
> 2.17.1
> 

      reply	other threads:[~2019-12-15 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 20:18 [PATCH] common/rc: fix device size parser Dennis Zhou
2019-12-15 16:40 ` Eryu Guan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191215164007.GC1776323@desktop \
    --to=guaneryu@gmail.com \
    --cc=dennis@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=kernel-team@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.