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

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 18 Jul 2024 15:35:02 +0000

Your bug report

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

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71979: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71979
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71979: (file-name->module-name (location-file (package-location pkg))) returns wrong module
From: Ludovic Courtès <[email-masked]>
To: Tomas Volf <[email-masked]>
Cc: [email-masked]
Date: Thu, 18 Jul 2024 17:34:08 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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’.

Subject: (file-name->module-name (location-file (package-location pkg))) returns wrong module
From: Tomas Volf <[email-masked]>
To: [email-masked]
Date: Sun, 7 Jul 2024 18:16:10 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

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.

The impact of this bug is broken guix pull for my channel (I will work around it
somehow, I hope) but still it would be nice if it worked properly, hence this report.

Have a nice day,
Tomas Volf

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.