Blob Blame History Raw
From 7011f8460b0f21b414fae2a62a330c1312ec6fc0 Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Fri, 6 Nov 2015 09:13:35 -0800
Subject: [PATCH] Fix regex in get_size_for_disk_name

Would break with 'sda10'. We need to non-greedily match the first subgroup.

Signed-off-by: Andy Grover <agrover@redhat.com>
---
 rtslib/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtslib/utils.py b/rtslib/utils.py
index 5531e8f..79a4d9d 100644
--- a/rtslib/utils.py
+++ b/rtslib/utils.py
@@ -152,7 +152,7 @@ def get_size_for_disk_name(name):
         return get_size("/sys/block/%s" % name)
     except IOError:
         # Maybe it's a partition?
-        m = re.search(r'^([a-z0-9_\-!]+)(\d+)$', name)
+        m = re.search(r'^([a-z0-9_\-!]+?)(\d+)$', name)
         if m:
             # If disk name ends with a digit, Linux sticks a 'p' between it and
             # the partition number in the blockdev name.