From unknown Sun Jun 22 08:07:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56075] [PATCH 0/2] Report location of invalid configuration field values Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Jun 2022 21:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56075 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56075@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165558822117189 (code B ref -1); Sat, 18 Jun 2022 21:38:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Jun 2022 21:37:01 +0000 Received: from localhost ([127.0.0.1]:50276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g7p-0004T0-DV for submit@debbugs.gnu.org; Sat, 18 Jun 2022 17:37:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:46840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g7l-0004Sk-4R for submit@debbugs.gnu.org; Sat, 18 Jun 2022 17:36:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2g7k-0005QP-UZ for guix-patches@gnu.org; Sat, 18 Jun 2022 17:36:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2g7j-0006DI-S0; Sat, 18 Jun 2022 17:36:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=6kEeTT6vYh4+B1K/28/3vgoKDBwD/vTEMs0E4lJkfc0=; b=nYIvuPXacuK7Up QAcJAlFiVa428bGMOOuSZbZw0h73t+R0wRGO5lniJ30JDVwTTXhnR4y7utWXlR8mv21d7CbRCUdkZ uLhb0yijZkhp/hybo/CNUpCHSwBSA61ScKQU/WMHglkQjr2EY71yXuEAGB23wXJ3/yZaCr+lENtK+ LL+VSPZKKNCGTh0Bpxp2H/PExb4RIpnMvfo3YAyoHmIQdbuC5iBEgmde130jpbn9+zQJK5n6zEQrf yvozUYqi0jeQIaTTHJMsizbqxPyp00SVTd98Z3DeYL+wJ6HIsEPQXGsH4+mpn3LSg3SnRN9d9BP8/ AgFVNiETUgsV0aDqf7Mw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56130 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o2g7j-0004rO-Fo; Sat, 18 Jun 2022 17:36:55 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 18 Jun 2022 23:36:40 +0200 Message-Id: <20220618213640.25039-1-ludo@gnu.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Guix! This change has ‘define-configuration’ use the ‘sanitize’ property to type-check fields instead of a custom mechanism. More importantly, it improves error reporting of invalid field value such that instead of: guix home: error: Invalid value for field latitude: "44.81" you get the location of the faulty field value: home-config.scm:391:23: error: invalid value "44.81" for field 'latitude' Additionally the message is now internationalized. Thoughts? Ludo’. Ludovic Courtès (2): services: configuration: Report the location of field type errors. services: configuration: Remove 'validate-configuration'. doc/guix.texi | 6 --- gnu/services/configuration.scm | 64 +++++++++++++++++++++----------- gnu/services/mail.scm | 6 +-- gnu/services/vpn.scm | 2 - po/guix/POTFILES.in | 1 + tests/services/configuration.scm | 12 ++++++ 6 files changed, 57 insertions(+), 34 deletions(-) base-commit: 7f208f68dea828fe02718ca8ce81d5975136cff8 -- 2.36.1 From unknown Sun Jun 22 08:07:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56075] [PATCH 1/2] services: configuration: Report the location of field type errors. References: <20220618213640.25039-1-ludo@gnu.org> In-Reply-To: <20220618213640.25039-1-ludo@gnu.org> Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Jun 2022 21:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56075 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56075@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 56075-submit@debbugs.gnu.org id=B56075.165558832817374 (code B ref 56075); Sat, 18 Jun 2022 21:39:01 +0000 Received: (at 56075) by debbugs.gnu.org; 18 Jun 2022 21:38:48 +0000 Received: from localhost ([127.0.0.1]:50284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g9X-0004W8-V9 for submit@debbugs.gnu.org; Sat, 18 Jun 2022 17:38:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g9W-0004Vn-Ka for 56075@debbugs.gnu.org; Sat, 18 Jun 2022 17:38:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45070) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2g9R-0006fU-4H; Sat, 18 Jun 2022 17:38:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=SLGijAEP8SZ5PZxaqvol+Om7X6k2mVpt45+qQvZxwuM=; b=rHj+/MgRtzf4Hm qCrqfAwsBoHgsyPmjF/IGAFgSbF7veP4ZL7HPhE+xwed9fxLyoBTswQ2ZunYL7U8qEbD0t0bf0IKV zhnqRjSW/ihyUbgVUrMbQH/V+cHOCPmxRI2Dkpbr6hXDrcmP8Bi1NeaYvtVLbWhyMJ/68vwAKP/e4 IN4TXYL2CUwbifC7bunTjAyYcFajZ4g0h4pkxc+jutF+6NWeng5nr0KxSDkVj83qDt8dDx9uzWsaj +B2Dht5KfJPtdKE9pOmkiSi1c4eEkOsPlu89QrbLWicZDPpN3PIGeWRmr7FHti8hOerJfEiegL5+P wXsQsVk2U6w3y6FDn+fg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:58587 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o2g9Q-00054e-Nx; Sat, 18 Jun 2022 17:38:40 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 18 Jun 2022 23:38:31 +0200 Message-Id: <20220618213832.25165-1-ludo@gnu.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Previously field type errors would be reported in a non-standard way, and without any source location information. This fixes it. * gnu/services/configuration.scm (configuration-field-error): Add a 'loc' parameter and honor it. Use 'formatted-message' instead of plain 'format'. (define-configuration-helper)[field-sanitizer]: New procedure. Use it. Use STEM as the identifier of the syntactic constructor of the record type. Add a 'sanitize' property to each field. Remove now useless STEM macro that would call 'validate-configuration'. * gnu/services/mail.scm (serialize-listener-configuration): Adjust to new 'configuration-field-error' prototype. * tests/services/configuration.scm ("wrong type for a field"): New test. * po/guix/POTFILES.in: Add gnu/services/configuration.scm. --- gnu/services/configuration.scm | 55 +++++++++++++++++++++++++------- gnu/services/mail.scm | 2 +- po/guix/POTFILES.in | 1 + tests/services/configuration.scm | 12 +++++++ 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index f6b20fb82b..c39ea5a02a 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -27,7 +27,8 @@ (define-module (gnu services configuration) #:use-module (guix records) #:use-module (guix gexp) #:use-module ((guix utils) #:select (source-properties->location)) - #:use-module ((guix diagnostics) #:select (formatted-message location-file)) + #:use-module ((guix diagnostics) + #:select (formatted-message location-file &error-location)) #:use-module ((guix modules) #:select (file-name->module-name)) #:use-module (guix i18n) #:autoload (texinfo) (texi-fragment->stexi) @@ -87,9 +88,17 @@ (define-condition-type &configuration-error &error (define (configuration-error message) (raise (condition (&message (message message)) (&configuration-error)))) -(define (configuration-field-error field val) - (configuration-error - (format #f "Invalid value for field ~a: ~s" field val))) +(define (configuration-field-error loc field value) + (raise (apply + make-compound-condition + (formatted-message (G_ "invalid value ~s for field '~a'") + value field) + (condition (&configuration-error)) + (if loc + (list (condition + (&error-location (location loc)))) + '())))) + (define (configuration-missing-field kind field) (configuration-error (format #f "~a configuration missing required field ~a" kind field))) @@ -210,9 +219,33 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (id #'stem #'serialize- type)))))) #'(field-type ...) #'((custom-serializer ...) ...)))) + (define (field-sanitizer name pred) + ;; Define a macro for use as a record field sanitizer, where NAME + ;; is the name of the field and PRED is the predicate that tells + ;; whether a value is valid for this field. + #`(define-syntax #,(id #'stem #'validate- #'stem #'- name) + (lambda (s) + ;; Make sure the given VALUE, for field NAME, passes PRED. + (syntax-case s () + ((_ value) + (with-syntax ((name #'#,name) + (pred #'#,pred) + (loc (datum->syntax #'value + (syntax-source #'value)))) + #'(if (pred value) + value + (configuration-field-error + (and=> 'loc source-properties->location) + 'name value)))))))) + #`(begin + ;; Define field validation macros. + #,@(map field-sanitizer + #'(field ...) + #'(field-predicate ...)) + (define-record-type* #,(id #'stem #'< #'stem #'>) - #,(id #'stem #'% #'stem) + stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) (%location #,(id #'stem #'stem #'-location) @@ -220,10 +253,13 @@ (define-record-type* #,(id #'stem #'< #'stem #'>) source-properties->location)) (innate)) #,@(map (lambda (name getter def) - #`(#,name #,getter (default #,def))) + #`(#,name #,getter (default #,def) + (sanitize + #,(id #'stem #'validate- #'stem #'- name)))) #'(field ...) #'(field-getter ...) #'(field-default ...))) + (define #,(id #'stem #'stem #'-fields) (list (configuration-field (name 'field) @@ -240,12 +276,7 @@ (define #,(id #'stem #'stem #'-fields) '#,(id #'stem #'% #'stem) 'field) field-default))) (documentation doc)) - ...)) - (define-syntax-rule (stem arg (... ...)) - (let ((conf (#,(id #'stem #'% #'stem) arg (... ...)))) - (validate-configuration conf - #,(id #'stem #'stem #'-fields)) - conf)))))))) + ...)))))))) (define no-serialization ;syntactic keyword for 'define-configuration' '(no serialization)) diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index d99743ac31..c2fd4d8670 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -285,7 +285,7 @@ (define (serialize-listener-configuration field-name val) (serialize-fifo-listener-configuration field-name val)) ((inet-listener-configuration? val) (serialize-inet-listener-configuration field-name val)) - (else (configuration-field-error field-name val)))) + (else (configuration-field-error #f field-name val)))) (define (listener-configuration-list? val) (and (list? val) (and-map listener-configuration? val))) (define (serialize-listener-configuration-list field-name val) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 201e5dcc87..f50dd00422 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -4,6 +4,7 @@ gnu.scm gnu/packages.scm gnu/services.scm gnu/system.scm +gnu/services/configuration.scm gnu/services/shepherd.scm gnu/home/services.scm gnu/home/services/ssh.scm diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 334a1e409b..cf3e504233 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -19,6 +19,7 @@ (define-module (tests services configuration) #:use-module (gnu services configuration) + #:use-module (guix diagnostics) #:use-module (guix gexp) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64)) @@ -43,6 +44,17 @@ (define-configuration port-configuration 80 (port-configuration-port (port-configuration))) +(test-equal "wrong type for a field" + '("configuration.scm" 56 11) ;error location + (guard (c ((configuration-error? c) + (let ((loc (error-location c))) + (list (basename (location-file loc)) + (location-line loc) + (location-column loc))))) + (port-configuration + ;; This is line 55; the test relies on line/column numbers! + (port "This is not a number!")))) + (define-configuration port-configuration-cs (port (number 80) "The port number." empty-serializer)) -- 2.36.1 From unknown Sun Jun 22 08:07:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56075] [PATCH 2/2] services: configuration: Remove 'validate-configuration'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Jun 2022 21:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56075 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56075@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 56075-submit@debbugs.gnu.org id=B56075.165558832817380 (code B ref 56075); Sat, 18 Jun 2022 21:39:01 +0000 Received: (at 56075) by debbugs.gnu.org; 18 Jun 2022 21:38:48 +0000 Received: from localhost ([127.0.0.1]:50286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g9Y-0004WB-Eb for submit@debbugs.gnu.org; Sat, 18 Jun 2022 17:38:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g9W-0004Vo-Th for 56075@debbugs.gnu.org; Sat, 18 Jun 2022 17:38:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2g9R-0006fc-MM; Sat, 18 Jun 2022 17:38:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=kOrUXQ7Z8s/HeG6itWK3lXB0Vi+vJNd8r7NpAp1xodM=; b=JcLas+03Oy7sCKLB5ybx YVhRdxI5tEJjuXK2ZWKWVLUi0on8MasGXuLDaBKPFuy0wyIFGUzoBHeAThL8pMKoRR7ptUPUtf0Fh 84rWIdE4TZilkvx0y4B5Me3VDBtfFvRIDHLl72dnhBL8C4eoUZS+V14vEzT23SnPSaIfu6Jn+lNr2 qP2/67iPOSo1BDt5Qy9ai+Pw4mQJmoIV/Qnlcbrw8VMD91XnMKfeu4oFQKpGqF1RDKTsXuaj9f8Fs RXNxLrhlQnXUNQ86w1xsiptPZhayxJ/DN/TdGH0bxiCWJ0eMFfjCw1/9xzjCJmThfXXHKXpLJjBB/ xxvgVbsoZ23nKg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:58587 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o2g9R-00054e-A8; Sat, 18 Jun 2022 17:38:41 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 18 Jun 2022 23:38:32 +0200 Message-Id: <20220618213832.25165-2-ludo@gnu.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220618213832.25165-1-ludo@gnu.org> References: <20220618213832.25165-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Now that configuration records use the 'sanitize' property for each field, 'validate-configuration' has become useless because it's impossible to construct an invalid configuration record. * gnu/services/configuration.scm (validate-configuration): Remove. * gnu/services/mail.scm (dovecot-service): Remove call. * gnu/services/vpn.scm (openvpn-client-service) (openvpn-server-service): Likewise. * doc/guix.texi (Complex Configurations): Remove documentation. --- doc/guix.texi | 6 ------ gnu/services/configuration.scm | 9 --------- gnu/services/mail.scm | 4 ---- gnu/services/vpn.scm | 2 -- 4 files changed, 21 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 86348fc02c..45f2620476 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -38886,12 +38886,6 @@ Return a G-expression that contains the values corresponding to the disk by using something like @code{mixed-text-file}. @end deffn -@deffn {Scheme Procedure} validate-configuration @var{configuration} -@var{fields} -Type-check @var{fields}, a list of field names of @var{configuration}, a -configuration record created by @code{define-configuration}. -@end deffn - @deffn {Scheme Procedure} empty-serializer @var{field-name} @var{value} A serializer that just returns an empty string. The @code{serialize-package} procedure is an alias for this. diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index c39ea5a02a..e3c101d042 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -57,7 +57,6 @@ (define-module (gnu services configuration) serialize-configuration define-maybe define-maybe/no-serialization - validate-configuration generate-documentation configuration->documentation empty-serializer @@ -125,14 +124,6 @@ (define (serialize-configuration config fields) ((configuration-field-getter field) config))) fields))) -(define (validate-configuration config fields) - (for-each (lambda (field) - (let ((val ((configuration-field-getter field) config))) - (unless ((configuration-field-predicate field) val) - (configuration-field-error - (configuration-field-name field) val)))) - fields)) - (define-syntax-rule (id ctx parts ...) "Assemble PARTS into a raw (unhygienic) identifier." (datum->syntax ctx (symbol-append (syntax->datum parts) ...))) diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index c2fd4d8670..10e6523861 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -1610,10 +1610,6 @@ (define* (dovecot-service #:key (config (dovecot-configuration))) by @code{dovecot-configuration}. @var{config} may also be created by @code{opaque-dovecot-configuration}, which allows specification of the @code{dovecot.conf} as a string." - (validate-configuration config - (if (opaque-dovecot-configuration? config) - opaque-dovecot-configuration-fields - dovecot-configuration-fields)) (service dovecot-service-type config)) ;; A little helper to make it easier to document all those fields. diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm index 8be632d55f..ec9ef6b6f0 100644 --- a/gnu/services/vpn.scm +++ b/gnu/services/vpn.scm @@ -540,11 +540,9 @@ (define openvpn-client-service-type to an existing @acronym{VPN, virtual private network}."))) (define* (openvpn-client-service #:key (config (openvpn-client-configuration))) - (validate-configuration config openvpn-client-configuration-fields) (service openvpn-client-service-type config)) (define* (openvpn-server-service #:key (config (openvpn-server-configuration))) - (validate-configuration config openvpn-server-configuration-fields) (service openvpn-server-service-type config)) (define (generate-openvpn-server-documentation) -- 2.36.1 From unknown Sun Jun 22 08:07:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56075] [PATCH 1/2] services: configuration: Report the location of field type errors. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Jun 2022 16:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56075 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 56075@debbugs.gnu.org Received: via spool by 56075-submit@debbugs.gnu.org id=B56075.165600032820539 (code B ref 56075); Thu, 23 Jun 2022 16:06:02 +0000 Received: (at 56075) by debbugs.gnu.org; 23 Jun 2022 16:05:28 +0000 Received: from localhost ([127.0.0.1]:39642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4PKh-0005LC-T2 for submit@debbugs.gnu.org; Thu, 23 Jun 2022 12:05:28 -0400 Received: from mail-qk1-f169.google.com ([209.85.222.169]:40713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4PKe-0005Kt-RO for 56075@debbugs.gnu.org; Thu, 23 Jun 2022 12:05:27 -0400 Received: by mail-qk1-f169.google.com with SMTP id p21so3289139qki.7 for <56075@debbugs.gnu.org>; Thu, 23 Jun 2022 09:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=j+qHXjpljw2+Iitx9Om3Glg/6jXKw2zb7ntKs1UCClQ=; b=U5WZPmCt1QhQkb/uzDDVLeA6F/sG/idbRQqvVqeg6KVzvQdPPx3uvWW6pgFwanmsGs LgSQQlkjZMWjI+OdV9OVxeHC7PCC4jOBqIPWsbapkFXjWsAam5SrteayvRWpqslqN0H9 03f2ohNU1hfYLzZPyvQMia24Z5JTbL3mMRjgCW5KUdkaCw1sTIonWgx2sPVfWskHV/CI AJiCLL01MYxuZ6RCjtjh3YltH52IVoEEKhzgoo94tFLJHmocVEA+wOfBO7JZGEnLHg6u /YROKkGgPFAYXoWOvYTcwoe/hv6fbEppMxStgEaWIXq1VoM+0xbHnlD/5kE/JpbyMLaq HQHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=j+qHXjpljw2+Iitx9Om3Glg/6jXKw2zb7ntKs1UCClQ=; b=cEzIRfJIFz6/Y7UiU/fyvQOohQ7m9gtw8r8OZyE9QEUkjIDz9eu2DCLulz/4p+hSrW qGeM0tSwh3fMpqZYke+668mNtsoYerDBymN6kRPAJZMOk4Y9zwHbctxqTP1B9UUtsjK7 Ijr6MeGIqSjzDa8Cr9EL/3H7PMTULK2XiJd+an3n6fbHvlkepFKn14t4p2PLJzbrWmol KAR9zzA+6raVelSXrV6I1wfn0SIQdZt0eWzIc7O8WhrszBS5RLHAAZFaddFSn3fWKpUF AhC2PHWFNiV+WxThlpwqwNgb46XiRwvaCBmLlzQSDJDO0xWH0vSwiTPh2pegdiqYgY2l Ivfg== X-Gm-Message-State: AJIora9zGaPtA32Eq0sQZ3+QluehrEdnfonJCQHLDq/z0BkLRHymcmCt 4dz7eyygrmg8uqpve/CbLROGYV2vzHgw1BmV X-Google-Smtp-Source: AGRyM1vvHyeLc8RBb/V6yOVsoFajhJ3hMjt3nTakxEfD4FZ5IvY4O97Qdgoj3upOlUj4HFKYm6TX7g== X-Received: by 2002:a37:a5d0:0:b0:6a6:7cbc:dc2a with SMTP id o199-20020a37a5d0000000b006a67cbcdc2amr6943012qke.496.1656000318421; Thu, 23 Jun 2022 09:05:18 -0700 (PDT) Received: from hurd (dsl-158-129.b2b2c.ca. [66.158.158.129]) by smtp.gmail.com with ESMTPSA id ey6-20020a05622a4c0600b0030a9dfb2898sm10375965qtb.85.2022.06.23.09.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 09:05:18 -0700 (PDT) From: Maxim Cournoyer References: <20220618213640.25039-1-ludo@gnu.org> <20220618213832.25165-1-ludo@gnu.org> Date: Thu, 23 Jun 2022 12:05:16 -0400 In-Reply-To: <20220618213832.25165-1-ludo@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sat, 18 Jun 2022 23:38:31 +0200") Message-ID: <87y1xn2wn7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Ludovic Court=C3=A8s writes: > Previously field type errors would be reported in a non-standard way, > and without any source location information. This fixes it. > > * gnu/services/configuration.scm (configuration-field-error): Add a > 'loc' parameter and honor it. Use 'formatted-message' instead of plain > 'format'. > (define-configuration-helper)[field-sanitizer]: New procedure. > Use it. Use STEM as the identifier of the syntactic constructor of the > record type. Add a 'sanitize' property to each field. Remove now > useless STEM macro that would call 'validate-configuration'. > * gnu/services/mail.scm (serialize-listener-configuration): Adjust to > new 'configuration-field-error' prototype. > * tests/services/configuration.scm ("wrong type for a field"): New test. > * po/guix/POTFILES.in: Add gnu/services/configuration.scm. Very nice! I had been meaning to look at what define-configure could be improved w.r.t. the recently added sanitizers; I felt perhaps `define-configure' would perhaps loose its relevance, but I'm happy to see you saw value in upgrading it! The first part LGTM, although I so rarely dabble with syntax-case that it looks a bit alien to my eyes now. [...] > --- a/tests/services/configuration.scm > +++ b/tests/services/configuration.scm > @@ -19,6 +19,7 @@ You forgot to add your copyright notice line. > (define-module (tests services configuration) > #:use-module (gnu services configuration) > + #:use-module (guix diagnostics) > #:use-module (guix gexp) > #:use-module (srfi srfi-34) > #:use-module (srfi srfi-64)) > @@ -43,6 +44,17 @@ (define-configuration port-configuration > 80 > (port-configuration-port (port-configuration))) > > +(test-equal "wrong type for a field" > + '("configuration.scm" 56 11) ;error location > + (guard (c ((configuration-error? c) > + (let ((loc (error-location c))) > + (list (basename (location-file loc)) > + (location-line loc) > + (location-column loc))))) > + (port-configuration > + ;; This is line 55; the test relies on line/column numbers! > + (port "This is not a number!")))) > + It seems fragile to rely on the line/column number, but if we truly need to test that, I don't see a better options. Thanks, Maxim From unknown Sun Jun 22 08:07:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#56075] [PATCH 2/2] services: configuration: Remove 'validate-configuration'. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Jun 2022 18:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56075 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 56075@debbugs.gnu.org Received: via spool by 56075-submit@debbugs.gnu.org id=B56075.16560090693374 (code B ref 56075); Thu, 23 Jun 2022 18:32:02 +0000 Received: (at 56075) by debbugs.gnu.org; 23 Jun 2022 18:31:09 +0000 Received: from localhost ([127.0.0.1]:39854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Rbh-0000sM-05 for submit@debbugs.gnu.org; Thu, 23 Jun 2022 14:31:09 -0400 Received: from mail-qk1-f174.google.com ([209.85.222.174]:44885) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Rbd-0000rn-7S for 56075@debbugs.gnu.org; Thu, 23 Jun 2022 14:31:07 -0400 Received: by mail-qk1-f174.google.com with SMTP id b125so4339280qkg.11 for <56075@debbugs.gnu.org>; Thu, 23 Jun 2022 11:31:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=IBCqGrUWtPgIhj7BGIaANjBr4iequfqadxtcj9dTXwg=; b=I5ZQeWQ2J0lyb9xn0SGT8zx+ubNP++1TF99lB9cuO9RIeSQDPL5yQVxaoluIsucJ3J hmtTddU+u+tAsD1J6fo2tREUj3nXW8kmnLHnqzvq/MJuBlD6aIV5r2+nua+fhoc8OgXo XrfAtf31mtg1YAII7QAA5JaMjFxISweJlOzLH5FSbmOderjnHMLCICjPJxrwUOWMDVV3 7iUJYxnvE6NdHNpljaMyfIYmx2p+s13c3Y1es99hmStCZnXvZNyrzlMNRYbE7qM3rdO/ E+kWytF8qk1uMKK+RpsS4Wcs5CsWoVg13CMPQaCReiZS/Zmf1tEDjQmg0uygX2OmV0G3 +sgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=IBCqGrUWtPgIhj7BGIaANjBr4iequfqadxtcj9dTXwg=; b=gnHG4bGLMYh4Tw3VAYhyhqjS12qDcrZM4D3fgCPHUaLXdoLyapQqpYR83ok4u98nIg F89/v4ELF4rxmwL/3mdeMI7zeY8nGNsxdeOx4OqiFgF1UsAzSN5+rsAkcbWhe31tt85O nKzewImkxhIEX8UfEc4QAdYz7ernSwpiOta+HBvx5zCuH8Q3FdjcgNUX3CxGzlngaFN3 WiQcM7Q0kT5Zljv2qKO+61K1sbJqkhj4a59bPoxlKl6H62pTLI5UxLD39lOlvk4epHh9 4puu0Ca5MmsH5aW56kmqe/U0bDtnmbQPc+rnsak4Nod8oY7NjPSQsh9wXzMLVSX6N4bJ NOKA== X-Gm-Message-State: AJIora8FVbUcXUjHkfdYHFVj5VrbXr/ATUvVPl0rX7VQL4DMkQHnlTUH eomSUrcA2wlRJn8ZZY5MpC5AhJhOvr3lA7E9 X-Google-Smtp-Source: AGRyM1tf3HjzGKsaFw+Ch5xrjDUuysVOlmxuwhOUsIJH0FCfmqCaBdM45utWvGYn+S2qrOQcgjvPpw== X-Received: by 2002:a05:620a:29ce:b0:6a7:1379:62d4 with SMTP id s14-20020a05620a29ce00b006a7137962d4mr7658281qkp.604.1656009059174; Thu, 23 Jun 2022 11:30:59 -0700 (PDT) Received: from hurd (dsl-158-129.b2b2c.ca. [66.158.158.129]) by smtp.gmail.com with ESMTPSA id cf20-20020a05622a401400b00304fa21762csm19434qtb.53.2022.06.23.11.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 11:30:58 -0700 (PDT) From: Maxim Cournoyer References: <20220618213832.25165-1-ludo@gnu.org> <20220618213832.25165-2-ludo@gnu.org> Date: Thu, 23 Jun 2022 14:30:57 -0400 In-Reply-To: <20220618213832.25165-2-ludo@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sat, 18 Jun 2022 23:38:32 +0200") Message-ID: <87czez2pwe.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, Ludovic Court=C3=A8s writes: > Now that configuration records use the 'sanitize' property for each > field, 'validate-configuration' has become useless because it's > impossible to construct an invalid configuration record. > > * gnu/services/configuration.scm (validate-configuration): Remove. > * gnu/services/mail.scm (dovecot-service): Remove call. > * gnu/services/vpn.scm (openvpn-client-service) > (openvpn-server-service): Likewise. > * doc/guix.texi (Complex Configurations): Remove documentation. I tried "make check-system TESTS=3D'prosody jami-provisioning'" and they pass. I guess it's good to go. Thank you! Maxim From unknown Sun Jun 22 08:07:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#56075: closed (Re: bug#56075: [PATCH 0/2] Report location of invalid configuration field values) Message-ID: References: <87czexu489.fsf_-_@gnu.org> <20220618213640.25039-1-ludo@gnu.org> X-Gnu-PR-Message: they-closed 56075 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 56075@debbugs.gnu.org Date: Fri, 24 Jun 2022 21:44:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1656107042-12790-1" This is a multi-part message in MIME format... ------------=_1656107042-12790-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #56075: [PATCH 0/2] Report location of invalid configuration field values which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 56075@debbugs.gnu.org. --=20 56075: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D56075 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1656107042-12790-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 56075-done) by debbugs.gnu.org; 24 Jun 2022 21:43:59 +0000 Received: from localhost ([127.0.0.1]:43737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4r5q-0003Jw-Vr for submit@debbugs.gnu.org; Fri, 24 Jun 2022 17:43:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50472) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4r5p-0003Jf-SM for 56075-done@debbugs.gnu.org; Fri, 24 Jun 2022 17:43:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r5k-0006uU-Hc; Fri, 24 Jun 2022 17:43:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=uEmXLFvCqRVnY0KFQhQ7/r+zJnvTy/0JLmy5Z0yujds=; b=KVVJw1DURCGnOTOvLa6N Gpq4LmvMSRv58xBMRd0/718UTzEhnLzwNyv6lT7KC7CMi7vV7gD8SJ76mUDoQ7eNPm6Eo1dR9ZwuC 4AWV0r7Ry4C8My1VJ7hmuhb8x9mtuX4bQLhgSRuoqfSn16kSOBorIH7ovOhmUGk4TY173ENhpD6aJ oem/WvSuLAAwcx0ZRE2AZlkx2q/biIDvXdRf9uSEM+FDyUtaW1jNL/jn5Kou88qUuldNsiWwYJH7H TBTtWGQvhUWR/ODAskzp4bG2GeLI4FmXsZ89ePscvknSB3OWnwItyKzxhl0PvUxKPQ+FAT5IAzI+W zWMe6TwLwo/T8Q==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:61327 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4r5k-0007fe-5g; Fri, 24 Jun 2022 17:43:52 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: bug#56075: [PATCH 0/2] Report location of invalid configuration field values References: <20220618213640.25039-1-ludo@gnu.org> <20220618213832.25165-1-ludo@gnu.org> <87y1xn2wn7.fsf@gmail.com> Date: Fri, 24 Jun 2022 23:43:50 +0200 In-Reply-To: <87y1xn2wn7.fsf@gmail.com> (Maxim Cournoyer's message of "Thu, 23 Jun 2022 12:05:16 -0400") Message-ID: <87czexu489.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56075-done Cc: 56075-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Maxim Cournoyer skribis: > Very nice! I had been meaning to look at what define-configure could be > improved w.r.t. the recently added sanitizers; I felt perhaps > `define-configure' would perhaps loose its relevance, but I'm happy to > see you saw value in upgrading it! Yeah, the mechanism that =E2=80=98define-configuration=E2=80=99 had had bec= ome redundant. > The first part LGTM, although I so rarely dabble with syntax-case that > it looks a bit alien to my eyes now. Well, =E2=80=98define-configuration=E2=80=99 is a bit hairy. :-) >> +++ b/tests/services/configuration.scm >> @@ -19,6 +19,7 @@ > > You forgot to add your copyright notice line. Fixed. >> +(test-equal "wrong type for a field" >> + '("configuration.scm" 56 11) ;error location >> + (guard (c ((configuration-error? c) >> + (let ((loc (error-location c))) >> + (list (basename (location-file loc)) >> + (location-line loc) >> + (location-column loc))))) >> + (port-configuration >> + ;; This is line 55; the test relies on line/column numbers! >> + (port "This is not a number!")))) >> + > > It seems fragile to rely on the line/column number, but if we truly need > to test that, I don't see a better options. Yeah; there is another option, which is to read code from a string port and to simulate its location, but it=E2=80=99s more lines of code for little IMO. Pushed, thanks! 6505f727e1 services: configuration: Remove 'validate-configuration'. fb7e6ccba7 services: configuration: Report the location of field type err= ors. Ludo=E2=80=99. ------------=_1656107042-12790-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Jun 2022 21:37:01 +0000 Received: from localhost ([127.0.0.1]:50276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g7p-0004T0-DV for submit@debbugs.gnu.org; Sat, 18 Jun 2022 17:37:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:46840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o2g7l-0004Sk-4R for submit@debbugs.gnu.org; Sat, 18 Jun 2022 17:36:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2g7k-0005QP-UZ for guix-patches@gnu.org; Sat, 18 Jun 2022 17:36:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2g7j-0006DI-S0; Sat, 18 Jun 2022 17:36:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=6kEeTT6vYh4+B1K/28/3vgoKDBwD/vTEMs0E4lJkfc0=; b=nYIvuPXacuK7Up QAcJAlFiVa428bGMOOuSZbZw0h73t+R0wRGO5lniJ30JDVwTTXhnR4y7utWXlR8mv21d7CbRCUdkZ uLhb0yijZkhp/hybo/CNUpCHSwBSA61ScKQU/WMHglkQjr2EY71yXuEAGB23wXJ3/yZaCr+lENtK+ LL+VSPZKKNCGTh0Bpxp2H/PExb4RIpnMvfo3YAyoHmIQdbuC5iBEgmde130jpbn9+zQJK5n6zEQrf yvozUYqi0jeQIaTTHJMsizbqxPyp00SVTd98Z3DeYL+wJ6HIsEPQXGsH4+mpn3LSg3SnRN9d9BP8/ AgFVNiETUgsV0aDqf7Mw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56130 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o2g7j-0004rO-Fo; Sat, 18 Jun 2022 17:36:55 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/2] Report location of invalid configuration field values Date: Sat, 18 Jun 2022 23:36:40 +0200 Message-Id: <20220618213640.25039-1-ludo@gnu.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Guix! This change has ‘define-configuration’ use the ‘sanitize’ property to type-check fields instead of a custom mechanism. More importantly, it improves error reporting of invalid field value such that instead of: guix home: error: Invalid value for field latitude: "44.81" you get the location of the faulty field value: home-config.scm:391:23: error: invalid value "44.81" for field 'latitude' Additionally the message is now internationalized. Thoughts? Ludo’. Ludovic Courtès (2): services: configuration: Report the location of field type errors. services: configuration: Remove 'validate-configuration'. doc/guix.texi | 6 --- gnu/services/configuration.scm | 64 +++++++++++++++++++++----------- gnu/services/mail.scm | 6 +-- gnu/services/vpn.scm | 2 - po/guix/POTFILES.in | 1 + tests/services/configuration.scm | 12 ++++++ 6 files changed, 57 insertions(+), 34 deletions(-) base-commit: 7f208f68dea828fe02718ca8ce81d5975136cff8 -- 2.36.1 ------------=_1656107042-12790-1--