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

From: Ludovic Courtès <[email-masked]>
Date: Sat, 15 Mar 2025 22:35:10 +0100

Hello,

Sergio Pastor Pérez <[email-masked]> 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' it in 'sbin/updatedb'.

I didn’t know about ‘plocate’.  :-)

Could yoiu add a line in the doc explicitly mentioning that ‘plocate’ is
supported, in addition to Findutils?

> +                         (let ((updatedb-bin #$(find (cut executable-file? <>)
> +                                                     (find-files (package-output (open-connection)
> +                                                                                 package)
> +                                                                 "^updatedb$"))))

This wouldn’t work for instance if ‘package’ hasn’t been built yet, and
also, it opens an extra connection to the daemon, which should be
avoided.

Instead, I’d write something like:

  (define updatedb
    (let ((try (lambda (file)
                 (and (file-exists? file) file))))
      (or (try #$(file-append package "/bin/updatedb"))
          (try #$(file-append package "/sbin/updatedb")))))

Could you send an updated patch?

Thanks,
Ludo’.