GNU bug report logs - #75568
[PATCH] gnu: smartmontools: Fix PATH in smartd_warning.sh.

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Tue, 14 Jan 2025 23:41:02 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75568 in the body.
You can then email your comments to 75568 AT debbugs.gnu.org in the normal way.

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

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


Report forwarded to sharlatanus <at> gmail.com, guix-patches <at> gnu.org:
bug#75568; Package guix-patches. (Tue, 14 Jan 2025 23:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to sharlatanus <at> gmail.com, guix-patches <at> gnu.org. (Tue, 14 Jan 2025 23:41:03 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: 75550 <at> debbugs.gnu.org,
	guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH] gnu: smartmontools: Fix PATH in smartd_warning.sh.
Date: Wed, 15 Jan 2025 00:40:19 +0100
The script started with reset of the $PATH to a value not suitable to Guix.
In addition, the script requires coreutils and sed, so add those into the
$PATH.

* gnu/packages/admin.scm (smartmontools)[arguments]<#:phases>: Add 'fix-path.

Change-Id: Ide97f572e6f369fe24337f945474dc7a65584eda
---
 gnu/packages/admin.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 7f50d5f4e9..098e21ff8a 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -2921,8 +2921,19 @@ (define-public smartmontools
                 "0gcrzcb4g7f994n6nws26g6x15yjija1gyzd359sjv7r3xj1z9p9"))))
     (build-system gnu-build-system)
     (arguments
-     (list #:make-flags
-           #~(list "BUILD_INFO=\"(Guix)\"")))
+     (list
+      #:make-flags
+      #~(list "BUILD_INFO=\"(Guix)\"")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'fix-path
+            (lambda _
+              (substitute* (string-append #$output "/etc/smartd_warning.sh")
+                (("export PATH=.*$" all)
+                 (string-append "PATH="
+                                #$(file-append sed "/bin") ":"
+                                #$(file-append coreutils "/bin") ":"
+                                "$PATH\n"))))))))
     (inputs (list libcap-ng))
     (home-page "https://www.smartmontools.org/")
     (synopsis "S.M.A.R.T. harddisk control and monitoring tools")
-- 
2.47.1





Information forwarded to guix-patches <at> gnu.org:
bug#75568; Package guix-patches. (Wed, 26 Mar 2025 21:36:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 75550 <at> debbugs.gnu.org, 75568 <at> debbugs.gnu.org,
 Sharlatan Hellseher <sharlatanus <at> gmail.com>
Subject: Re: [bug#75568] [PATCH] gnu: smartmontools: Fix PATH in
 smartd_warning.sh.
Date: Wed, 26 Mar 2025 22:35:08 +0100
Tomas Volf <~@wolfsden.cz> skribis:

> The script started with reset of the $PATH to a value not suitable to Guix.
> In addition, the script requires coreutils and sed, so add those into the
> $PATH.
>
> * gnu/packages/admin.scm (smartmontools)[arguments]<#:phases>: Add 'fix-path.
>
> Change-Id: Ide97f572e6f369fe24337f945474dc7a65584eda

[...]

> +          (add-after 'install 'fix-path
> +            (lambda _
> +              (substitute* (string-append #$output "/etc/smartd_warning.sh")
> +                (("export PATH=.*$" all)
> +                 (string-append "PATH="
> +                                #$(file-append sed "/bin") ":"
> +                                #$(file-append coreutils "/bin") ":"

Please use (dirname (search-input-file inputs "/bin/sed")) etc. instead.
That way, when creating a variant with different inputs, the right thing
will be used.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#75568; Package guix-patches. (Wed, 26 Mar 2025 21:46:03 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 75550 <at> debbugs.gnu.org, 75568 <at> debbugs.gnu.org,
 Sharlatan Hellseher <sharlatanus <at> gmail.com>
Subject: Re: [bug#75568] [PATCH] gnu: smartmontools: Fix PATH in
 smartd_warning.sh.
Date: Wed, 26 Mar 2025 22:45:55 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Tomas Volf <~@wolfsden.cz> skribis:
>
>> The script started with reset of the $PATH to a value not suitable to Guix.
>> In addition, the script requires coreutils and sed, so add those into the
>> $PATH.
>>
>> * gnu/packages/admin.scm (smartmontools)[arguments]<#:phases>: Add 'fix-path.
>>
>> Change-Id: Ide97f572e6f369fe24337f945474dc7a65584eda
>
> [...]
>
>> +          (add-after 'install 'fix-path
>> +            (lambda _
>> +              (substitute* (string-append #$output "/etc/smartd_warning.sh")
>> +                (("export PATH=.*$" all)
>> +                 (string-append "PATH="
>> +                                #$(file-append sed "/bin") ":"
>> +                                #$(file-append coreutils "/bin") ":"
>
> Please use (dirname (search-input-file inputs "/bin/sed")) etc. instead.
> That way, when creating a variant with different inputs, the right thing
> will be used.

Merged version uses the following:

--8<---------------cut here---------------start------------->8---
    (arguments
     (list
      #:make-flags
      #~(list "BUILD_INFO=\"(Guix)\"")
      #:configure-flags
      #~(list (format #f "--with-scriptpath=~{~a:~}$PATH"
                      (map (lambda (pkg)
                             (in-vicinity pkg "bin"))
                           '#$(list (this-package-input "coreutils-minimal")
                                    (this-package-input "sed")))))))
--8<---------------cut here---------------end--------------->8---

Is that acceptable as well or should I send a patch switching to
search-input-file?

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#75568; Package guix-patches. (Tue, 01 Apr 2025 10:16:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 75550 <at> debbugs.gnu.org, 75568 <at> debbugs.gnu.org,
 Sharlatan Hellseher <sharlatanus <at> gmail.com>
Subject: Re: [bug#75568] [PATCH] gnu: smartmontools: Fix PATH in
 smartd_warning.sh.
Date: Tue, 01 Apr 2025 12:15:37 +0200
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

> Merged version uses the following:
>
>     (arguments
>      (list
>       #:make-flags
>       #~(list "BUILD_INFO=\"(Guix)\"")
>       #:configure-flags
>       #~(list (format #f "--with-scriptpath=~{~a:~}$PATH"
>                       (map (lambda (pkg)
>                              (in-vicinity pkg "bin"))
>                            '#$(list (this-package-input "coreutils-minimal")
>                                     (this-package-input "sed")))))))
>
> Is that acceptable as well or should I send a patch switching to
> search-input-file?

I have a slight preference for ‘search-input-file’ but this version is
perfectly fine.

Thanks,
Ludo’.




bug closed, send any further explanations to 75568 <at> debbugs.gnu.org and Tomas Volf <~@wolfsden.cz> Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 15 Apr 2025 08:25:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 May 2025 11:24:17 GMT) Full text and rfc822 format available.

This bug report was last modified 54 days ago.

Previous Next


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