[PATCH] services: Add error/success service type.

  • Done
  • quality assurance status badge
Details
4 participants
  • ???
  • Jakob Honal
  • Ludovic Courtès
  • Simon Tournier
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 1 Apr 2023 09:28
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20230401072842.13315-1-ludo@gnu.org
* gnu/services/base.scm (error/success-boot-gexp): New procedure.
(error/success-service-type): New variable.
(%base-services): Add an instance of it.
* doc/guix.texi (Base Services): Document it.
---
doc/guix.texi | 26 ++++++++++++++++++++++++++
gnu/services/base.scm | 27 +++++++++++++++++++++++++++
2 files changed, 53 insertions(+)

Hello Guix!

A while back, we committed a change that removed the boot-time
message we’d been seeing, “error in finalization thread: Success”:


This change was not universally acclaimed. Some complained that
the boot process had seemingly become opaque because it’s now harder
to tell whether it’s making progress successfully, while others
were disappointed that their newly acquired sticker had become
obsolete.

This patch reinstates that message. The previous implementation
worked by closing a file descriptor that Guile relied on internally.
The new implementation takes a different approach, with the
error-reporting device implemented right into the service, which
should give us more flexibility—e.g., the service could be extended
to report other error codes.

The new ‘error/success-service-type’ is added to ‘%base-services’,
the default list of system services. I think it’s good to have it
by default, but that’s something we can discuss.

Feedback welcome!

Ludo’.

Toggle diff (91 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index a58ea8f9ec..605ed648c4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19007,6 +19007,32 @@ about the Pluggable Authentication Module (PAM) limits, refer to the
@samp{pam_limits} man page from the @code{linux-pam} package.
@end defvar
+@cindex success, and error (service type)
+@cindex error, and success (service type)
+
+@defvar error/success-service-type
+This is the service type for the iconic ``error in finalization thread:
+Success'' boot-time message that long-time Guix System users are
+familiar with. It is part of @code{%base-services} (enabled by
+default).
+
+New users who do not feel the need for this service can disable it by
+filtering it out of their service list. For instance, if you are using
+@code{%desktop-services}, you can change your operating system
+configuration like so (@pxref{Service Reference,
+@code{modify-services}}):
+
+@lisp
+(operating-system
+ ;; @dots{}
+ (services (modify-services %desktop-services
+ (delete error/success-service-type))))
+@end lisp
+
+However, we do not recommend it as you could lose sight of how weird and
+beautiful your system is.
+@end defvar
+
@defvar greetd-service-type
@uref{https://git.sr.ht/~kennylevinsen/greetd, @code{greetd}} is a minimal and
flexible login manager daemon, that makes no assumptions about what you
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index e063828d3b..5479cd63cf 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -248,6 +248,8 @@ (define-module (gnu services base)
pam-limits-service-type
pam-limits-service ; deprecated
+ error/success-service-type
+
greetd-service-type
greetd-configuration
greetd-terminal-configuration
@@ -2990,6 +2992,29 @@ (define %qemu-static-networking
(provision '(networking))
(name-servers '("10.0.2.3"))))
+
+;;;
+;;; The iconic error/success message service.
+;;;
+
+(define (error/success-boot-gexp _)
+ #~(begin
+ (display "error in finalization thread: Success\n"
+ (current-error-port))
+ (sleep 2))) ;let the user notice--all this hasn't been in vain
+
+(define error/success-service-type
+ (service-type
+ (name 'error/success)
+ (extensions
+ (list (service-extension boot-service-type
+ error/success-boot-gexp)))
+ (default-value 42)
+ (description
+ "This service prints the iconic error/success message at boot time. The
+message acts as a lighthouse for seasoned users--and seasoned users to
+be!--who immediately know, when they see it, that everything's alright.")))
+
;;;
;;; greetd-service-type -- minimal and flexible login manager daemon
@@ -3364,6 +3389,8 @@ (define %base-services
(service sysctl-service-type)
+ (service error/success-service-type)
+
(service special-files-service-type
`(("/bin/sh" ,(file-append bash "/bin/sh"))
("/usr/bin/env" ,(file-append coreutils "/bin/env"))))))
--
2.39.2
?
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 62584@debbugs.gnu.org)
87y1nbevqp.fsf@envs.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (3 lines)
> I think it’s good to have it by default, but that’s something we can
> discuss.

Okay, I don't think so...

Toggle quote (6 lines)
> +(define (error/success-boot-gexp _)
> + #~(begin
> + (display "error in finalization thread: Success\n"
> + (current-error-port))
> + (sleep 2))) ;let the user notice--all this hasn't been in vain

How about make the message and delay customable?

I prefer "No error in finalization thread: Success",
and 2 seconds may not be enough for a slow reader like me!

Toggle quote (9 lines)
> +
> +(define error/success-service-type
> + (service-type
> + (name 'error/success)
> + (extensions
> + (list (service-extension boot-service-type
> + error/success-boot-gexp)))
> + (default-value 42)

What are this 42 is for?


Otherwise look good to me, thank you!
L
L
Ludovic Courtès wrote on 1 Apr 2023 18:51
(name . ???)(address . iyzsong@envs.net)(address . 62584@debbugs.gnu.org)
87pm8nfsvu.fsf_-_@gnu.org
Hi ???,

??? <iyzsong@envs.net> skribis:

Toggle quote (7 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> I think it’s good to have it by default, but that’s something we can
>> discuss.
>
> Okay, I don't think so...

Well, naming and defaults are two hard issues in programming.

Toggle quote (11 lines)
>> +(define (error/success-boot-gexp _)
>> + #~(begin
>> + (display "error in finalization thread: Success\n"
>> + (current-error-port))
>> + (sleep 2))) ;let the user notice--all this hasn't been in vain
>
> How about make the message and delay customable?
>
> I prefer "No error in finalization thread: Success",
> and 2 seconds may not be enough for a slow reader like me!

Ah yes, good points! We could probably have a configuration record like
we do for other services. That way, one could write, say:

(service error/success-service-type
(error/success-configuration
(errno EINVAL)
(message-type 'no-error)
(delay 10)))

I’d prefer to leave that for a subsequent patch though, so we can first
restore the previous situation.

Toggle quote (10 lines)
>> +(define error/success-service-type
>> + (service-type
>> + (name 'error/success)
>> + (extensions
>> + (list (service-extension boot-service-type
>> + error/success-boot-gexp)))
>> + (default-value 42)
>
> What are this 42 is for?

It’s currently unused but increases the chances that it’ll give the
right answer.

Thanks for your feedback!

Ludo’.
L
L
L
Ludovic Courtès wrote on 2 Apr 2023 15:32
(name . ???)(address . iyzsong@envs.net)(address . 62584@debbugs.gnu.org)
878rfav28x.fsf_-_@gnu.org
Hi!

Ludovic Courtès <ludo@gnu.org> skribis:

Toggle quote (4 lines)
> BTW, I wrote about the rationale in more detail in a blog post:
>
> https://guix.gnu.org/en/blog/2023/reinstating-an-iconic-error-message/

In hindsight, seen from April 2nd, it seems that the status quo might be
preferable after all.

Closing!

Ludo’.
L
L
Ludovic Courtès wrote on 2 Apr 2023 15:32
control message for bug #62584
(address . control@debbugs.gnu.org)
877cuuv28l.fsf@gnu.org
tags 62584 wontfix
close 62584
quit
?
Re: bug#62584: [PATCH] services: Add error/success service type.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 62584@debbugs.gnu.org)
87h6txb8jq.fsf@envs.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (4 lines)
>> BTW, I wrote about the rationale in more detail in a blog post:
>>
>> https://guix.gnu.org/en/blog/2023/reinstating-an-iconic-error-message/

A interesting story, thank you!


Toggle quote (5 lines)
> In hindsight, seen from April 2nd, it seems that the status quo might be
> preferable after all.
>
> Closing!

Heh, I was asked by several people how to run a command/script
during (or at the end of) system booting, this service does seems a good
to place to satisfy that use case :)
S
S
Simon Tournier wrote on 4 Apr 2023 12:59
Re: [bug#62584] [PATCH] services: Add error/success service type.
(address . 62584@debbugs.gnu.org)
86jzyrvroj.fsf@gmail.com
Hi Ludo,

On Sun, 02 Apr 2023 at 15:32, Ludovic Courtès <ludo@gnu.org> wrote:
Toggle quote (11 lines)
> Ludovic Courtès <ludo@gnu.org> skribis:
>
>> BTW, I wrote about the rationale in more detail in a blog post:
>>
>> https://guix.gnu.org/en/blog/2023/reinstating-an-iconic-error-message/
>
> In hindsight, seen from April 2nd, it seems that the status quo might be
> preferable after all.
>
> Closing!

Well, I am not sure to understand if it is an April’s fool (so a good
one! ;-)) or a serious patch.

In both cases, I am missing why it would not be possible to have the
default “error = success“, since it is potentially possible to turn it
off and so have something as no error => success.

Emacs has ton of historical weird defaults. Basically, I do not see the
issue with such defaults if there is an explanation (in the manual,
say).


Cheers,
simon
J
J
Jakob Honal wrote on 27 Apr 2023 05:53
Re: [bug#62584] [PATCH] services: Add error/success service type
(address . 62584@debbugs.gnu.org)
trinity-91e9b094-3b3f-4205-9dfc-8d807fa60410-1682567619099@3c-app-gmx-bap57
Attachment: file
?