GNU bug report logs - #74532
with-extensions does not add native extensions to the load path

Previous Next

Package: guix;

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

Date: Mon, 25 Nov 2024 17:51:01 UTC

Severity: normal

Full log


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

From: Tomas Volf <~@wolfsden.cz>
To: Timo Wilken <guix <at> twilken.net>
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Z572 <zhengjunjie <at> iscas.ac.cn>, 74532 <at> debbugs.gnu.org
Subject: Re: bug#74532: [PATCH] gnu: guile-yamlpp: Allow usage with
 `with-extensions'
Date: Sun, 16 Mar 2025 15:30:57 +0100
[Message part 1 (text/plain, inline)]
Hi!

Timo Wilken <guix <at> twilken.net> writes:

> * gnu/packages/guile-xyz.scm (guile-yamlpp) [arguments] <phases>:
>   Add 'set-extension-file-name.
>
> Change-Id: I49a7199b4e0fe4053822374bae59c6e1d0b7ead0
> ---
>  gnu/packages/guile-xyz.scm | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
> index 30c8e847996..f43e06a3a7f 100644
> --- a/gnu/packages/guile-xyz.scm
> +++ b/gnu/packages/guile-xyz.scm
> @@ -1997,6 +1997,19 @@ (define-public guile-yamlpp
>         (sha256
>          (base32 "0ik69y0vddg0myp0zdbkmklma0qkkrqzwlqwkij1zirklz6hl1ss"))))
>      (build-system gnu-build-system)
> +    (arguments
> +     `(#:phases
> +       ,#~(modify-phases %standard-phases
> +            ;; In order to let Guile find the compiled library when used with
> +            ;; Guix' `with-extension', hardcode the final path to the library.
> +            ;; The fallback is needed for tests (i.e. before the 'install phase).
> +            ;; See <https://issues.guix.gnu.org/74532>.
> +            (add-after 'unpack 'set-extension-file-name
> +              (lambda* (#:key outputs #:allow-other-keys)
> +                (substitute* "scm/yamlpp.scm"
> +                  (("\\(load-extension \"libguile-yamlpp\"(.*)\\)" all init)
> +                   (format #f "(or (false-if-exception (load-extension \"~a/lib/guile/3.0/libguile-yamlpp\"~a)) ~a)"
> +                           (assoc-ref outputs "out") init all))))))))

I am not sure it is optimal to hide *all* errors from load-extension.
Maybe check if file exists and then try to load-extension it without the
false-if-exception?

(Sure there is a TOCTTOU problem, but I think that can be ignored in
this case.)

>      (native-inputs (list autoconf automake libtool pkg-config))
>      (inputs (list guile-3.0 yaml-cpp))
>      (native-search-paths

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

This bug report was last modified 44 days ago.

Previous Next


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