aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/file-systems.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-07-16 09:49:36 +0200
committerLudovic Courtès <ludo@gnu.org>2015-07-16 09:49:36 +0200
commit1cab9e810ef7843afdbd101ad967f835cfb64999 (patch)
treea72b0bf84ca491834a94b92ad3ce93cd9b9de879 /gnu/system/file-systems.scm
parent68e88a09b46cc2b4affebbd258decbcd4024f0db (diff)
downloadguix-1cab9e810ef7843afdbd101ad967f835cfb64999.tar
guix-1cab9e810ef7843afdbd101ad967f835cfb64999.tar.gz
file-systems: 'uuid' raises a syntax error for invalid UUIDs.
* gnu/system/file-systems.scm (uuid): Call 'syntax-violation' when 'string->uuid' returns #f. * tests/file-systems.scm ("uuid, syntax error"): New test.
Diffstat (limited to 'gnu/system/file-systems.scm')
-rw-r--r--gnu/system/file-systems.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index ece8fb41e6..0f3e6fbcaa 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -153,8 +153,10 @@ UUID representation."
((_ str)
(string? (syntax->datum #'str))
;; A literal string: do the conversion at expansion time.
- (with-syntax ((bv (string->uuid (syntax->datum #'str))))
- #''bv))
+ (let ((bv (string->uuid (syntax->datum #'str))))
+ (unless bv
+ (syntax-violation 'uuid "invalid UUID" s))
+ (datum->syntax #'str bv)))
((_ str)
#'(string->uuid str)))))