GNU bug report logs - #62584
[PATCH] services: Add error/success service type.

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Sat, 1 Apr 2023 07:29:02 UTC

Severity: normal

Tags: patch, wontfix

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 62584 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 宋文武 <iyzsong <at> envs.net>
Cc: 62584 <at> debbugs.gnu.org
Subject: Re: bug#62584: [PATCH] services: Add error/success service type.
Date: Sat, 01 Apr 2023 18:51:17 +0200
Hi 宋文武,

宋文武 <iyzsong <at> envs.net> skribis:

> Ludovic Courtès <ludo <at> 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.

>> +(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.

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




This bug report was last modified 2 years and 104 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.