emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56075: closed ([PATCH 0/2] Report location of invalid configuration


From: GNU bug Tracking System
Subject: bug#56075: closed ([PATCH 0/2] Report location of invalid configuration field values)
Date: Fri, 24 Jun 2022 21:44:02 +0000

Your message dated Fri, 24 Jun 2022 23:43:50 +0200
with message-id <87czexu489.fsf_-_@gnu.org>
and subject line Re: bug#56075: [PATCH 0/2] Report location of invalid 
configuration field values
has caused the debbugs.gnu.org bug report #56075,
regarding [PATCH 0/2] Report location of invalid configuration field values
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
56075: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56075
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH 0/2] Report location of invalid configuration field values Date: Sat, 18 Jun 2022 23:36:40 +0200
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




--- End Message ---
--- Begin Message --- Subject: Re: bug#56075: [PATCH 0/2] Report location of invalid configuration field values Date: Fri, 24 Jun 2022 23:43:50 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> 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 ‘define-configuration’ had had become
redundant.

> The first part LGTM, although I so rarely dabble with syntax-case that
> it looks a bit alien to my eyes now.

Well, ‘define-configuration’ 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’s more lines of code for little
IMO.

Pushed, thanks!

  6505f727e1 services: configuration: Remove 'validate-configuration'.
  fb7e6ccba7 services: configuration: Report the location of field type errors.

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]