unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 27155@debbugs.gnu.org
Subject: bug#27155: [PATCH 0/2] Support service extensions on the "final" service values
Date: Sun, 04 Jun 2017 17:26:41 +0300	[thread overview]
Message-ID: <87o9u3q15q.fsf@gmail.com> (raw)
In-Reply-To: <8737bgkbsy.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 03 Jun 2017 23:21:01 +0200")

Ludovic Courtès (2017-06-03 23:21 +0200) wrote:

> Ludovic Courtès <ludo@gnu.org> skribis:
>
>> This patch adds support for service extensions that modify the
>> "final" values of a service.  This is meant to implement cross-cutting
>> concerns as well as system-wide customization as discussed with Alex
>> long ago:
>>
>>   https://lists.gnu.org/archive/html/guix-devel/2015-11/msg00623.html
>>   https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01505.html
>>
>> To summarize, a "finalization extension" (for lack of a better name)
>> gets the final value of a service and returns a new value for that
>> service.
>
> I found a better name: “customizations”.

I kinda like "finalization" more :-)  But "customization" is fine with
me, not a big deal.

>> For example, for the /etc service, a "normal" extension can only add
>> entries for /etc.  A "finalization" extension can instead inspect and
>> change all the /etc entries.  IOW, it is a sort of a "sudo" for service
>> extensions; it's also quite inelegant compared to the "normal" extension
>> mechanism, but it's certainly useful.
>
> Not liking the “sudo” aspect of this patch, I thought it would be
> natural if service types could control how customizations apply.  That
> way, the PAM or /etc service could still guarantee, for instance, that
> customization does not add or remove entries, and so on.

Ouch, that's what I don't like.  I think a full control is better.
You'll never know what a user might want to do, and giving a user a full
freedom (even to break a system!) would be a great feature.  So I'm
against such guarantees that strict users in modifying their systems.

> In the end, this control by the service type makes it easier to reason
> about what extensions do, whereas the “sudo” style means that an
> extension can alter the service’s value in any possible way.

Right, "any possible way" is exactly what I want!

> So I started modifying this patch set to add a ‘customize’ field to
> <service-type>, next to ‘extend’.  For the PAM and /etc services,
> ‘customize’ would compose and apply procedures that modify an entry, for
> instance.
>
> Then I realized that the only difference between ‘customize’ and
> ‘extend’ would be the meaning attached to it.  IOW, both are some kind
> of an extension.
>
> So at this point, I started wondering whether we should just allow
> service types to declare several extension points.  So for PAM, we’d do:
>
> (define pam-service-addition
>   ;; The extension point to add PAM services.
>   (service-extension-point
>     (compose concatenate)
>     (extend append)))
>
> (define pam-service-cutomization
>   ;; The extension point to customize PAM services.
>   (service-extension-point
>     (compose compose)
>     (extend append)))
>
> (define pam-root-service-type
>   (service-type (name 'pam)
>                 (extensions (list (service-extension etc-service-type
>                                                      /etc-entry)))
>
>                 (extension-points (list pam-service-addtion
>                                         pam-service-customization))))
>
> But then ‘service-extension’ would need to specify not only the target
> service type but also the target extension point, which means more
> boilerplate, etc.

I don't have a deep understanding of services, but your suggestion seems
(to me) to have the following downsides:

- More additional work – to determine (and implement) what aspects of
  services should and what should not be modified by a user.

- Less freedom (comparing to your previous solution) for users in
  modifying services.

> So after so much thought and hacking, I feel like the ad hoc solution at
> <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01505.html>
> was not that bad after all.

He-he :-)

> Sorry to bother you with philosophical design questions when we already
> have two ways to solve the problem at hand, but I feel like there’s a
> pattern worth looking for!

No problem, looking for patterns is always an interesting occupation!
As for me, I agree with any solution that allows me to replace
"/etc/profile".  But in general, I vote for that solution that allows
users to customize as much things as possible.

-- 
Alex

  reply	other threads:[~2017-06-04 14:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 21:58 bug#27155: [PATCH 0/2] Support service extensions on the "final" service values Ludovic Courtès
2017-05-30 22:05 ` bug#27155: [PATCH 1/2] DRAFT services: Extensions can specify a "finalization" procedure Ludovic Courtès
2017-05-30 22:05   ` bug#27155: [PATCH 2/2] system: pam: Remove custom API to transform PAM services Ludovic Courtès
2017-06-01  9:57 ` bug#27155: [PATCH 0/2] Support service extensions on the "final" service values Alex Kost
2017-06-01 11:24   ` Ludovic Courtès
2017-06-03 21:21 ` Ludovic Courtès
2017-06-04 14:26   ` Alex Kost [this message]
2017-06-05 10:06     ` Ludovic Courtès
2017-06-05 12:52 ` Ricardo Wurmus
2017-06-06 23:07   ` Ludovic Courtès
2017-06-15 17:12     ` [bug#27155] " 宋文武
2017-06-21 13:06       ` 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

  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=87o9u3q15q.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=27155@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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).