public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common/rc: fix device size parser
@ 2019-12-11 20:18 Dennis Zhou
  2019-12-15 16:40 ` Eryu Guan
  0 siblings, 1 reply; 2+ messages in thread
From: Dennis Zhou @ 2019-12-11 20:18 UTC (permalink / raw)
  To: fstests; +Cc: kernel-team, Dennis Zhou

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}'
 }
 
 # Make sure we actually have dmesg checking set up.
-- 
2.17.1


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

end of thread, other threads:[~2019-12-15 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-11 20:18 [PATCH] common/rc: fix device size parser Dennis Zhou
2019-12-15 16:40 ` Eryu Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox