From 1cab9e810ef7843afdbd101ad967f835cfb64999 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 16 Jul 2015 09:49:36 +0200 Subject: 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. --- gnu/system/file-systems.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gnu') 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))))) -- cgit 1.4.1