GNU bug report logs - #77629
[PATCH] services: tlp: Make destructor return #f on success.

Previous Next

Package: guix-patches;

Reported by: Nigko Yerden <nigko.yerden <at> gmail.com>

Date: Tue, 8 Apr 2025 06:44:02 UTC

Severity: normal

Tags: patch

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

To reply to this bug, email your comments to 77629 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#77629; Package guix-patches. (Tue, 08 Apr 2025 06:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nigko Yerden <nigko.yerden <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 08 Apr 2025 06:44:02 GMT) Full text and rfc822 format available.

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

From: Nigko Yerden <nigko.yerden <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Nigko Yerden <nigko.yerden <at> gmail.com>
Subject: [PATCH] services: tlp: Make destructor return #f on success.
Date: Tue,  8 Apr 2025 11:30:24 +0500
* gnu/services/pm.scm (tlp-shepherd-service): Make destructor
return #f on success. Destructor "should return #f if it is
now possible again to start the service at a later point"
(shepherd manual).

Change-Id: Ic0d21d32af158da1ae940d9c32c05a3471767764
---
Without this patch tlp service brings annoying messages "Service tlp might
have failed to stop" to the system log. Thanks to lfam and Rutherther on
IRC for mentioning in relation to other service that the destructor of a
shepherd service should return #f on success.

 gnu/services/pm.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index e022437748..12f05b4b33 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe <at> gmail.com>
 ;;; Copyright © 2024 Dariqq <dariqq <at> posteo.net>
 ;;; Copyright © 2024 Ian Eure <ian <at> retrospec.tv>
+;;; Copyright © 2025 Nigko Yerden <nigko.yerden <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -459,15 +460,17 @@ (define-configuration tlp-configuration
 (define (tlp-shepherd-service config)
   (let* ((tlp-bin (file-append
                    (tlp-configuration-tlp config) "/sbin/tlp"))
-         (tlp-action (lambda args
+         (tlp-action (lambda (return-value-on-success . args)
                        #~(lambda _
-                           (zero? (system* #$tlp-bin #$@args))))))
+                           (if (zero? (system* #$tlp-bin #$@args))
+                               #$return-value-on-success
+                               (not #$return-value-on-success))))))
     (list (shepherd-service
            (documentation "Run TLP script.")
            (provision '(tlp))
            (requirement '(user-processes))
-           (start (tlp-action "init" "start"))
-           (stop  (tlp-action "init" "stop"))))))
+           (start (tlp-action #t "init" "start"))
+           (stop  (tlp-action #f "init" "stop"))))))
 
 (define (tlp-activation config)
   (let* ((config-str (with-output-to-string

base-commit: c9524b5841a057b5e64abf0dca75261e741949c5
-- 
2.49.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 08 Apr 2025 15:30:05 GMT) Full text and rfc822 format available.

Notification sent to Nigko Yerden <nigko.yerden <at> gmail.com>:
bug acknowledged by developer. (Tue, 08 Apr 2025 15:30:05 GMT) Full text and rfc822 format available.

Message #10 received at 77629-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Nigko Yerden <nigko.yerden <at> gmail.com>
Cc: 77629-done <at> debbugs.gnu.org
Subject: Re: [bug#77629] [PATCH] services: tlp: Make destructor return #f on
 success.
Date: Tue, 08 Apr 2025 17:07:07 +0200
Nigko Yerden <nigko.yerden <at> gmail.com> skribis:

> * gnu/services/pm.scm (tlp-shepherd-service): Make destructor
> return #f on success. Destructor "should return #f if it is
> now possible again to start the service at a later point"
> (shepherd manual).
>
> Change-Id: Ic0d21d32af158da1ae940d9c32c05a3471767764

Applied, thanks!




This bug report was last modified 4 days ago.

Previous Next


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