GNU bug report logs - #77037
[PATCH] services: `file-database-mcron-jobs' search updatedb in package field

Previous Next

Package: guix-patches;

Reported by: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>

Date: Sat, 15 Mar 2025 14:20:03 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: bug#77037: closed (Re: bug#77037: [PATCH] services:
 `file-database-mcron-jobs' search updatedb in package field)
Date: Tue, 01 Apr 2025 12:01:05 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#77037: [PATCH] services: `file-database-mcron-jobs' search updatedb in package field

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 77037 <at> debbugs.gnu.org.

-- 
77037: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77037
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Cc: 77037-done <at> debbugs.gnu.org
Subject: Re: bug#77037: [PATCH] services: `file-database-mcron-jobs' search
 updatedb in package field
Date: Tue, 01 Apr 2025 14:00:27 +0200
Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com> skribis:

> `file-database-service-type' appends 'bin/updatedb' path to the `package'
> field provided by `file-database-configuration'. This prevents users from
> using alternate packages which also provide 'updatedb' but in a different
> location.
>
> For example, the `plocate' package installs 'updatedb' in 'sbin/updatedb'.
>
> Fallback to 'sbin/' if 'updatedb' is not found in 'bin/'.
>
> * gnu/services/admin.scm (file-database-mcron-jobs): locate 'updatedb' binary.
>
> Change-Id: Ic741716044be3a8f51a157510f9f923bd66c41d7

Hi!  I update ‘doc/guix.texi’ to match the docstring you changed and
applied it.

Thanks,
Ludo’.

[Message part 3 (message/rfc822, inline)]
From: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Sergio Pastor Pérez <sergio.pastorperez <at> gmail.com>
Subject: [PATCH] services: `file-database-mcron-jobs' search updatedb in
 package field
Date: Sat, 15 Mar 2025 15:18:30 +0100
`file-database-service-type' appends 'bin/updatedb' path to the `package'
field provided by `file-database-configuration'. This prevents users from
using alternate packages which also provide 'updatedb' but in a different
location.

For example, the `plocate' package installs 'updatedb' it in 'sbin/updatedb'.

Use `find-files' to locate the binary within the user configured package.

* gnu/services/admin.scm (file-database-mcron-jobs): locate 'updatedb' binary.

Change-Id: Id35b26cbe41261a0ac3add53757d240b003aa26e
---
 gnu/services/admin.scm | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index 2a11a4f4f10..19b0d64f2c2 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -37,13 +37,16 @@ (define-module (gnu services admin)
   #:use-module (gnu services shepherd)
   #:use-module (gnu system accounts)
   #:use-module ((gnu system shadow) #:select (account-service-type))
-  #:use-module ((guix store) #:select (%store-prefix))
+  #:use-module ((guix store) #:select (%store-prefix
+                                       open-connection))
   #:use-module (guix deprecation)
   #:use-module (guix gexp)
   #:use-module (guix modules)
   #:use-module (guix packages)
   #:use-module (guix records)
+  #:use-module (guix build utils)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
   #:use-module (ice-9 vlist)
   #:export (log-rotation-configuration
@@ -473,17 +476,21 @@ (define (file-database-mcron-jobs configuration)
                      #~(begin
                          ;; 'updatedb' is a shell script that expects various
                          ;; commands in $PATH.
-                         (setenv "PATH"
-                                 (string-append #$package "/bin:"
-                                                #$(canonical-package coreutils)
-                                                "/bin:"
-                                                #$(canonical-package sed)
-                                                "/bin"))
-                         (execl #$(file-append package "/bin/updatedb")
-                                "updatedb"
-                                #$(string-append "--prunepaths="
-                                                 (string-join
-                                                  excluded-directories)))))))
+                         (let ((updatedb-bin #$(find (cut executable-file? <>)
+                                                     (find-files (package-output (open-connection)
+                                                                                 package)
+                                                                 "^updatedb$"))))
+                           (setenv "PATH"
+                                   (string-append (dirname updatedb-bin) ":"
+                                                  #$(canonical-package coreutils)
+                                                  "/bin:"
+                                                  #$(canonical-package sed)
+                                                  "/bin"))
+                           (execl updatedb-bin
+                                  "updatedb"
+                                  #$(string-append "--prunepaths="
+                                                   (string-join
+                                                    excluded-directories))))))))
       (list #~(job #$schedule #$updatedb)))))
 
 (define file-database-service-type

base-commit: 412f411d4f8780e6b60b448caae17f01c09be0eb
-- 
2.48.1




This bug report was last modified 109 days ago.

Previous Next


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