From: Tomas Volf <~@wolfsden.cz>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 71979@debbugs.gnu.org
Subject: bug#71979: (file-name->module-name (location-file (package-location pkg))) returns wrong module
Date: Thu, 18 Jul 2024 23:21:32 +0200 [thread overview]
Message-ID: <ZpmHXCnJIhmjFftx@ws> (raw)
In-Reply-To: <87ed7qvhn3.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 4173 bytes --]
Hello Ludo',
On 2024-07-18 17:34:08 +0200, Ludovic Courtès wrote:
> Hi Tomas,
>
> Tomas Volf <~@wolfsden.cz> 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!
Thank you for the fix. I can confirm (using the original reproducer) that it
works when run from guix repl:
$ GUILE_AUTO_COMPILE=0 guix repl -qL .
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guix-user)> ,use (xx)
;;; ((xx))
However there seem to be few more edge cases that are still not working.
Dot multiple times:
$ GUILE_AUTO_COMPILE=0 guix repl -qL ././.
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guix-user)> ,use (xx)
;;; ((#{.}# #{.}# xx))
Double-dot:
$ GUILE_AUTO_COMPILE=0 guix repl -qL ../tmp
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guix-user)> ,use (xx)
;;; ((.. tmp xx))
Should I report those as separate bugs? Or do you think I should just re-open
this one?
Side-note: I have to say I am confused about behavior of guix repl with
/dev/stdin. Everything seems to work there:
$ echo '(use-modules (xx))' | GUILE_AUTO_COMPILE=0 guix repl -L . /dev/stdin
;;; ((xx))
$ echo '(use-modules (xx))' | GUILE_AUTO_COMPILE=0 guix repl -L ././. /dev/stdin
;;; ((xx))
$ echo '(use-modules (xx))' | GUILE_AUTO_COMPILE=0 guix repl -L ../tmp /dev/stdin
;;; ((xx))
I have no idea why. I would also try -c as I did in my original reproduces, but
guix repl does not support it (I wonder why).
For completeness' sake I am including original message I wrote before trying
`guix repl' and therefore writing the above text instead:
However I am unsure whether it works. I pulled the Guix channel:
$ guix describe
Generation 1 Jul 18 2024 18:44:20 (current)
guix e3dfed5
repository URL: https://git.savannah.gnu.org/git/guix.git
branch: master
commit: e3dfed59d39ac60dd2e2b9ef9f4ef63a2a081f41
As far as I can tell that commit should include your fix (or even better, that
commit is your fix). However when I try the reproducer from the original bug
report, I am still getting:
$ GUILE_AUTO_COMPILE=0 guile -L . -c '(use-modules (xx))'
;;; ((#{.}# xx))
>
> Thanks,
> Ludo’.
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2024-07-18 21:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-07 16:16 bug#71979: (file-name->module-name (location-file (package-location pkg))) returns wrong module Tomas Volf
2024-07-18 15:34 ` Ludovic Courtès
2024-07-18 21:21 ` Tomas Volf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZpmHXCnJIhmjFftx@ws \
--to=~@wolfsden.cz \
--cc=71979@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).