all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Josselin Poiret via Guix-patches via <guix-patches@gnu.org>
To: 51922@debbugs.gnu.org
Cc: Josselin Poiret <dev@jpoiret.xyz>
Subject: [bug#51922] [PATCH 0/2] Improve the reported location of configuration warnings
Date: Wed, 17 Nov 2021 14:40:28 +0000	[thread overview]
Message-ID: <20211117144028.16722-1-dev@jpoiret.xyz> (raw)

Hello everyone,

While working on the swap-space patch, I noticed that currently,
warnings about deprecated fields in guix records use the location of
the record definition macro, rather than of the invalid value.  For
some records such as 'operating-system', this makes it rather user
unfriendly and confusing.

This patchset first adds the syntax 'define-with-syntax-properties',
which helps avoid boilerplate code to define sanitizers with proper
location reporting.  I put it in guix/diagnostics.scm as I thought
this was the place that was most likely to be use-module'd for warning
messages, as this is quite tied to that use.  The second patch makes
use of this new helper to update two warnings: the one about 'target'
to 'targets' in bootloader.scm, and the one about setuid-programs.  In
both cases, a `guix system reconfigure` now reports the exact location
of the incriminating values, rather than of the
'bootloader-configuration' or 'operating-system' lines respectively.

The approach I've taken for the helper was to make something simple
and general enough for most uses.  It should correctly report syntax
errors with custom errors messages rather than the generic "source
expression failed to match any pattern ...".  Note although that it
isn't possible to do any defines in the body of the macro, as this
doesn't use any lambda-like macros (see the second case for an
example).

I can see two drawbacks to this macro:
1) This macro will not help you write expand-time checkers.  This
would introduce too much complexity, and I'm not sure the end-user
would notice a significant change.
2) It doesn't deconstruct values such as lists to get the individual
list values's properties.  This would also introduce too much
complexity (eg. checking if the list is literal, deconstructing it,
and falling back to a generic source location if the list is only
available at eval-time).

Best,
Josselin Poiret

Josselin Poiret (2):
  guix: Add syntax to capture arguments' syntax-properties.
  gnu: system: Improve location of some configuration warnings.

 gnu/bootloader.scm   | 16 +++++++---------
 gnu/system.scm       | 11 ++++++-----
 guix/diagnostics.scm | 38 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 50 insertions(+), 15 deletions(-)

-- 
2.33.1





             reply	other threads:[~2021-11-17 14:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 14:40 Josselin Poiret via Guix-patches via [this message]
2021-11-17 14:43 ` [bug#51922] [PATCH 1/2] guix: Add syntax to capture arguments' syntax-properties Josselin Poiret via Guix-patches via
2021-11-17 14:43   ` [bug#51922] [PATCH 2/2] gnu: system: Improve location of some configuration warnings Josselin Poiret via Guix-patches via
2021-11-17 16:58 ` bug#51922: [PATCH 0/2] Improve the reported location of " Ludovic Courtès

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

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

  git send-email \
    --in-reply-to=20211117144028.16722-1-dev@jpoiret.xyz \
    --to=guix-patches@gnu.org \
    --cc=51922@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.