Subject: Re: bug#73030: git send-email missing perl packages [partially FIXED]

From: Simon Tournier <[email-masked]>
Date: Thu, 05 Sep 2024 04:03:38 +0200

Hi,

For the fixes see <https://issues.guix.gnu.org/73034>.

Explanation below.

On Wed, 04 Sep 2024 at 20:57, Simon Tournier <[email-masked]> wrote:

> --8<---------------cut here---------------start------------->8---
> Not using SSL_VERIFY_PEER due to out-of-date IO::Socket::SSL.
> To use SSL please install IO::Socket::SSL with version>=2.007 at /gnu/store/v6bivyjbg6bj07s8iqfzdm6hpvypc0p1-perl-5.36.0/lib/perl5/5.36.0/Net/SMTP.pm line 268.
> --8<---------------cut here---------------end--------------->8---

It is a regression introduced in core-updates, recently merged,

    f2886044: gnu: git: Remove labels and use gexps.

Well, it was not straightforward to spot the bug. :-) Especially when
’git bisect’ is useless.  Therefore, I locally reverted all the 8
suspicious commits modifying packages as git or git-minimal and then
investigated one by one.

Once the culprit had been identified, it was easier to spot the
unexpected part.  Roughly, this snippet:

               ;; Tell 'git-send-email' where perl modules are.
               (wrap-program git-se*
                 `("PERL5LIB" ":" prefix
                   ,(map (lambda (o) (string-append o "/lib/perl5/site_perl"))
                         (list
                          ,@(transitive-input-references
                             'inputs
                             (map (lambda (l)
                                    (assoc l (package-inputs this-package)))
                                  '("perl-authen-sasl"
                                    "perl-net-smtp-ssl"
                                    "perl-io-socket-ssl")))))))

had been translated into:

                ;; Tell 'git-send-email' where perl modules are.
                (wrap-program git-se*
                  `("PERL5LIB" ":" prefix
                    ,(search-path-as-list
                      '("lib/perl5/site_perl")
                      '#$(delete-duplicates
                          (append-map
                           (compose last package-transitive-propagated-inputs)
                           (list (this-package-input "perl-authen-sasl")
                                 (this-package-input "perl-net-smtp-ssl")
                                 (this-package-input "perl-io-socket-ssl")))))))

The former essentially reads:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use(gnu packages version-control)
scheme@(guix-user)> (define this-package git)
scheme@(guix-user)> ,pp (transitive-input-references
                             'inputs
                             (map (lambda (l)
                                    (assoc l (package-inputs this-package)))
                                  '("perl-authen-sasl"
                                    "perl-net-smtp-ssl"
                                    "perl-io-socket-ssl")))
$1 = ((assoc-ref inputs "perl-authen-sasl")
 (assoc-ref inputs "perl-net-smtp-ssl")
 (assoc-ref inputs "perl-io-socket-ssl")
 (assoc-ref inputs "perl-gssapi")
 (assoc-ref inputs "perl-digest-hmac")
 (assoc-ref inputs "perl-uri")
 (assoc-ref inputs "perl-net-ssleay"))
--8<---------------cut here---------------end--------------->8---

and the last essentially reads:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use(srfi srfi-1)
scheme@(guix-user)> (define (this-package-input name) (or (lookup-package-input this-package name) (lookup-package-native-input this-package name)))
scheme@(guix-user)> ,pp (append-map
                           (compose last package-transitive-propagated-inputs)
                           (list (this-package-input "perl-authen-sasl")
                                 (this-package-input "perl-net-smtp-ssl")
                                 (this-package-input "perl-io-socket-ssl")))
$2 = ("perl-gssapi"
 #<package [email-masked] gnu/packages/web.scm:3527 72334030c580>
 "perl-net-ssleay"
 #<package [email-masked] gnu/packages/tls.scm:819 72333ffc8e70>
 "perl-uri"
 #<package [email-masked] gnu/packages/web.scm:4819 723340318160>)
--8<---------------cut here---------------end--------------->8---

Because ’last’ is applied before ’append-map’, it keeps only the last
elements of all the propagated-inputs for each of the 3.  For instance:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (package-transitive-propagated-inputs (this-package-input "perl-authen-sasl"))
$3 = (("perl-digest-hmac" #<package [email-masked] gnu/packages/perl.scm:4029 72333e2ba420>) ("perl-gssapi" #<package [email-masked] gnu/packages/web.scm:3527 72334030c580>))
--8<---------------cut here---------------end--------------->8---

When what is needed is all the package objects.  Therefore, it’s not
possible to compose.

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,pp (map last (append-map
                           package-transitive-propagated-inputs
                           (list (this-package-input "perl-authen-sasl")
                                 (this-package-input "perl-net-smtp-ssl")
                                 (this-package-input "perl-io-socket-ssl"))))
$4 = (#<package [email-masked] gnu/packages/perl.scm:4029 72333e2ba420>
 #<package [email-masked] gnu/packages/web.scm:3527 72334030c580>
 #<package [email-masked] gnu/packages/web.scm:4206 723340310160>
 #<package [email-masked] gnu/packages/web.scm:4819 723340318160>
 #<package [email-masked] gnu/packages/tls.scm:819 72333ffc8e70>
 #<package [email-masked] gnu/packages/tls.scm:819 72333ffc8e70>
 #<package [email-masked] gnu/packages/web.scm:4819 723340318160>)
--8<---------------cut here---------------end--------------->8---

I guess that’s the same story for 'gitweb.cgi'.

Cheers,
simon