Subject: [bug#57387] [PATCH] gnu: Add restartd.

From: Maxime Devos <[email-masked]>
Date: Fri, 26 Aug 2022 16:03:41 +0200

On 26-08-2022 09:32, Nicolas Graves via Guix-patches via wrote:

> [...]
> +         (patches
> +          (search-patches
> +           "restartd-fix-compilation.patch"
> +           "restartd-add-error-handling-for-robustness.patch"))))
> [...]
>   (define-public rex
>     (package
>       (name "rex")
> diff --git a/gnu/packages/patches/restartd-add-error-handling-for-robustness.patch b/gnu/packages/patches/restartd-add-error-handling-for-robustness.patch
> new file mode 100644
> index 0000000000..f0abcf1dac
> --- /dev/null
> +++ b/gnu/packages/patches/restartd-add-error-handling-for-robustness.patch
> @@ -0,0 +1,232 @@
> +From ec606eb15091ff8ffa672500413128c29814f8ad Mon Sep 17 00:00:00 2001
> +From: Yin Kangkai <[email-masked]>, Maxime Devos <[email-masked]>
A bit of a nitpick, but Yin Kagkai was not involved in this patch, I 
wrote it myself ...
> +Date: Thu, 25 Aug 2022 14:29:25 +0200
> +Subject: [PATCH] Add some error handling for robustness.
> +
> +This makes the code a little more robust. What if /var/run does not
> +exist, or we do not have permission to open
> +/var/run/restartd.pid (EPERM?) due to SELinux misconfiguration?
> +This patch also avoids segmentation fault when run from non-root user.
> +---
> +[..]
> +            for(i=0; i<config_process_number; i++) {
> +                if (strlen(config_process[i].processes) > 0) {
> +                    if (strlen(config_process[i].running) > 0) {
> +                        strcpy(config_process[i].status, "running");
> +-                       syslog(LOG_INFO, "%s is running, executing '%s'",
> ++                       /* syslog(LOG_INFO, "%s is running, executing '%s'",
> +                               config_process[i].name,
> +-                              config_process[i].running);
> ++                              config_process[i].running); */

... the commenting syslog thing was an unrelated patch, maybe various 
commits were squashed?

When I tried out the patch, I added a local copy of 
https://patch-diff.githubusercontent.com/raw/ajraymond/restartd/pull/8.patch 
to the list of patches and "guix build" succeeded, there was no need to 
squash things.

Greetings,
Maaxime.