--- blivet/size.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/blivet/size.py b/blivet/size.py index d9af722..7c03c2e 100644 --- a/blivet/size.py +++ b/blivet/size.py @@ -75,7 +75,11 @@ def _parseSpec(spec): if not spec: raise ValueError("invalid size specification", spec)
- m = re.match(r'(-?\s*[0-9.]+)\s*([A-Za-z]*)$', spec.strip()) + # This regex isn't ideal, since \w matches both letters and digits, + # but python doesn't provide a means to match only Unicode letters. + # Probably the worst that will come of it is that bad specs will fail + # more confusingly. + m = re.match(r'(-?\s*[0-9.]+)\s*(\w*)$', spec.decode("utf-8").strip(), flags=re.UNICODE) if not m: raise ValueError("invalid size specification", spec)
@@ -102,6 +106,8 @@ def _parseSpec(spec): def xlate_size(spec): """Translate English size specifiers into the current locale."""
+ # Keep the non-unicode A-Za-z here since the input is English and + # this lets us be lazier about matching the non-specifier part m = re.match(r'(.*?)([A-Za-z]*)$', spec.strip()) if not m: raise ValueError("invalid size specification", spec)