summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-02-23 12:42:58 +0100
committerLudovic Courtès <ludo@gnu.org>2020-02-23 12:47:13 +0100
commitfa99c4bbc7acdb8def9ce14a05aacb73f99fe3b1 (patch)
tree953d26ba2fc7e05c0b04ab45cb0fed8b0a1d25b9 /guix
parent9f2fef4fb164df81034c2b114292d836a9f6d4f8 (diff)
ui: (size->number "1.M") is correctly parsed.
Reported by Pierre Neidhardt <mail@ambrevar.xyz>. * guix/ui.scm (size->number)[unit-pos]: Add #\. to CHAR-SET:DIGIT. * tests/ui.scm ("size->number, 1.M"): New test.
Diffstat (limited to 'guix')
-rw-r--r--guix/ui.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index dce97fb7b9..db932ecacb 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -591,7 +591,8 @@ nicely."
\"1MiB\", to a number of bytes. Raise an error if STR could not be
interpreted."
(define unit-pos
- (string-rindex str char-set:digit))
+ (string-rindex str
+ (char-set-union (char-set #\.) char-set:digit)))
(define unit
(and unit-pos (substring str (+ 1 unit-pos))))