Subject: bug#78700: closed (Re: [bug#78700] [PATCH] gnu: tlp: Fix scripts.)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 09 Jun 2025 20:08:30 +0000

Your bug report

#78700: [PATCH] gnu: tlp: Fix scripts.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78700: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78700
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#78700] [PATCH] gnu: tlp: Fix scripts.
From: Ludovic Courtès <[email-masked]>
To: Morgan Smith <[email-masked]>
Cc: [email-masked], Leo Famulari <[email-masked]>
Date: Mon, 09 Jun 2025 22:04:12 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Morgan Smith <[email-masked]> writes:

> tlp provides a number of executables.  Before this change the "tlp" and "tlp-stat"
> executables worked fine but the "bluetooth", "nfc", "run-on-ac", "run-on-bat",
> "wifi", and "wwan" executables would give strange warnings.
>
> * gnu/packages/linux.scm (tlp): Fix scripts.
> <phases> [wrap]: Use wrap-script instead of wrap-program to preserve shell
> argument "$0".  Don't wrap symlinks.
> <inputs>: Add guile-3.0 for wrap-script.  Remove bash used for now removed
> wrap-program.
>
> Change-Id: I916a4385cb69db142f834839aa9aaf0d81085714

Applied, thanks!

Subject: [PATCH] gnu: tlp: Fix scripts.
From: Morgan Smith <[email-masked]>
To: [email-masked]
Cc: Morgan Smith <[email-masked]>
Date: Thu, 5 Jun 2025 11:42:14 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

tlp provides a number of executables.  Before this change the "tlp" and "tlp-stat"
executables worked fine but the "bluetooth", "nfc", "run-on-ac", "run-on-bat",
"wifi", and "wwan" executables would give strange warnings.

* gnu/packages/linux.scm (tlp): Fix scripts.
<phases> [wrap]: Use wrap-script instead of wrap-program to preserve shell
argument "$0".  Don't wrap symlinks.
<inputs>: Add guile-3.0 for wrap-script.  Remove bash used for now removed
wrap-program.

Change-Id: I916a4385cb69db142f834839aa9aaf0d81085714
---
 gnu/packages/linux.scm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index ccf0567827..504b09b0a7 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -145,6 +145,7 @@ (define-module (gnu packages linux)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages guile)
   #:use-module (gnu packages haskell-apps)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages image)
@@ -8512,11 +8513,11 @@ (define-public tlp
     (native-inputs
      (list shellcheck))
     (inputs
-     `(("bash" ,bash)
-       ("dbus" ,dbus)
+     `(("dbus" ,dbus)
        ("ethtool" ,ethtool)
        ("eudev" ,eudev)
        ("grep" ,grep)
+       ("guile" ,guile-3.0) ;for wrap-script
        ("hdparm" ,hdparm)
        ("inetutils" ,inetutils)
        ("iw" ,iw)
@@ -8574,15 +8575,20 @@ (define-public tlp
             (lambda* (#:key inputs outputs #:allow-other-keys)
               (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
                      (sbin (string-append (assoc-ref outputs "out") "/sbin"))
-                     (bin-files (find-files bin ".*"))
-                     (sbin-files (find-files sbin ".*")))
+                     ;; Used to ignore symlinks which don't need wrapping
+                     (regular-file-predicate
+                      (lambda (file stat) (eq? 'regular (stat:type stat))))
+                     (bin-files (find-files bin regular-file-predicate))
+                     (sbin-files (find-files sbin regular-file-predicate)))
                 (define (bin-directory input-name)
                   (let ((p (assoc-ref inputs input-name)))
                     (and p (string-append p "/bin"))))
                 (define (sbin-directory input-name)
                   (string-append (assoc-ref inputs input-name) "/sbin"))
                 (for-each (lambda (program)
-                            (wrap-program program
+                            ;; Programs rely on $0 so we use wrap-script
+                            ;; instead of wrap-program
+                            (wrap-script program
                               `("PATH" ":" prefix
                                 ,(append
                                   (filter-map bin-directory

base-commit: 027a47787f8dcf6651a1c20c5b475376defe6d6b
-- 
2.49.0