unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 56075-done@debbugs.gnu.org
Subject: bug#56075: [PATCH 0/2] Report location of invalid configuration field values
Date: Fri, 24 Jun 2022 23:43:50 +0200	[thread overview]
Message-ID: <87czexu489.fsf_-_@gnu.org> (raw)
In-Reply-To: <87y1xn2wn7.fsf@gmail.com> (Maxim Cournoyer's message of "Thu, 23 Jun 2022 12:05:16 -0400")

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’.




      reply	other threads:[~2022-06-24 21:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-18 21:36 [bug#56075] [PATCH 0/2] Report location of invalid configuration field values Ludovic Courtès
2022-06-18 21:38 ` [bug#56075] [PATCH 1/2] services: configuration: Report the location of field type errors Ludovic Courtès
2022-06-18 21:38   ` [bug#56075] [PATCH 2/2] services: configuration: Remove 'validate-configuration' Ludovic Courtès
2022-06-23 18:30     ` Maxim Cournoyer
2022-06-23 16:05   ` [bug#56075] [PATCH 1/2] services: configuration: Report the location of field type errors Maxim Cournoyer
2022-06-24 21:43     ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czexu489.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=56075-done@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).