Subject: Re: bug#71979: (file-name->module-name (location-file (package-location pkg))) returns wrong module

From: Ludovic Courtès <[email-masked]>
Date: Thu, 18 Jul 2024 17:34:08 +0200

Hi Tomas,

Tomas Volf <[email-masked]> skribis:

> when I try to use the above, it returns wrong module.  The module returned is
> prefixed by #{.}# symbol.  Full reproducer:
>
>     (define-module (xx)
>       #:use-module (guix)
>       #:use-module (guix modules)
>       #:use-module (guix utils))
>
>     (define-public pkg
>       (package
>         (name "foo")
>         (version #f)
>         (source #f)
>         (build-system #f)
>         (synopsis #f)
>         (description #f)
>         (license #f)
>         (home-page #f)))
>
>     (pk (file-name->module-name (location-file (package-location pkg))))
>
> Now just run it:
>
>     $ GUILE_AUTO_COMPILE=0 guile -L . -c '(use-modules (xx))'
>
>     ;;; ((#{.}# xx))
>
> Notice that the module is not just (xx) as it should have been.

Oh, good catch.

I went ahead and pushed a fix as
e3dfed59d39ac60dd2e2b9ef9f4ef63a2a081f41.  Let me know if you find
anything wrong!

Thanks,
Ludo’.