unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Richard Sent <richard@freakingpenguin.com>
Cc: 71928@debbugs.gnu.org
Subject: [bug#71928] [PATCH v2] gnu: Throw error when extending services that do not use extensions.
Date: Mon, 30 Sep 2024 22:43:36 +0200	[thread overview]
Message-ID: <87h69w50uf.fsf@gnu.org> (raw)
In-Reply-To: <6afb44e7f09f2d8fdbbe4cd0bad92ca170aef1b0.1720045261.git.richard@freakingpenguin.com> (Richard Sent's message of "Wed, 3 Jul 2024 18:21:01 -0400")

Hello,

Richard Sent <richard@freakingpenguin.com> skribis:

> * gnu/services.scm (fold-services): Add error handling when using service
> extensions.
>
> Fixes: https://issues.guix.gnu.org/71887
> Change-Id: Ic8d631674bfddde495c93952d9e6cd5649bb287d

[...]

> @@ -1223,12 +1224,22 @@ (define* (fold-services services
>                       (params     -> (service-value sink))
>                       (service
>                        ->
> -                      ;; Distinguish COMPOSE and EXTEND because PARAMS typically
> -                      ;; has a different type than the elements of EXTENSIONS.
> -                      (if extend
> -                          (service (service-kind sink)
> -                                   (extend params (compose extensions)))
> -                          sink)))
> +                      (begin
> +                        (unless (or (null? extensions)
> +                                    ;; A value of #t is a convention for "make
> +                                    ;; sure the service is present."
> +                                    (every (cut eq? #t <>) extensions)
> +                                    (and extend compose))
> +                          (error (format #f "Extensions are not supported in \
> +~a yet the following service types extend it:~{~%   ~a~}"
> +                                         (service-kind sink)
> +                                         (map service-kind dependents))))
> +                        ;; Distinguish COMPOSE and EXTEND because PARAMS typically
> +                        ;; has a different type than the elements of EXTENSIONS.
> +                        (if extend
> +                            (service (service-kind sink)
> +                                     (extend params (compose extensions)))
> +                            sink))))

I understand the current situation where extensions to a non-extensible
service are silently swallowed is suboptimal, but I wonder about the
implications of the semantic change here.

Currently the “#t means ensure the service is present” convention is not
enforced; is it even widely followed in the Guix repo?  But then, what
about repos out there that provide services?

It would seem to me that this is something that cannot be changed
overnight without running the risk to break people’s code.  So perhaps
the first step (and maybe last step?) would be to print a warning.

WDYT?

Thanks,
Ludo’.




      reply	other threads:[~2024-09-30 21:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 22:12 [bug#71928] [PATCH] gnu: Throw error when extending services that do not use extensions Richard Sent
2024-07-03 22:21 ` [bug#71928] [PATCH v2] " Richard Sent
2024-09-30 20: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=87h69w50uf.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=71928@debbugs.gnu.org \
    --cc=richard@freakingpenguin.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).