GNU bug report logs - #56075
[PATCH 0/2] Report location of invalid configuration field values

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sat, 18 Jun 2022 21:38:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 56075-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 56075-done <at> debbugs.gnu.org
Subject: Re: bug#56075: [PATCH 0/2] Report location of invalid configuration
 field values
Date: Fri, 24 Jun 2022 23:43:50 +0200
Hi,

Maxim Cournoyer <maxim.cournoyer <at> 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’.




This bug report was last modified 3 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.