GNU bug report logs - #71979
(file-name->module-name (location-file (package-location pkg))) returns wrong module

Previous Next

Package: guix;

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

Date: Sun, 7 Jul 2024 16:17:02 UTC

Severity: normal

To reply to this bug, email your comments to 71979 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#71979; Package guix. (Sun, 07 Jul 2024 16:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 07 Jul 2024 16:17:02 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: bug-guix <at> gnu.org
Subject: (file-name->module-name (location-file (package-location pkg)))
 returns wrong module
Date: Sun, 7 Jul 2024 18:16:10 +0200
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 18 Jul 2024 15:35:02 GMT) Full text and rfc822 format available.

Notification sent to Tomas Volf <~@wolfsden.cz>:
bug acknowledged by developer. (Thu, 18 Jul 2024 15:35:02 GMT) Full text and rfc822 format available.

Message #10 received at 71979-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 71979-done <at> debbugs.gnu.org
Subject: Re: bug#71979: (file-name->module-name (location-file
 (package-location pkg))) returns wrong module
Date: Thu, 18 Jul 2024 17:34:08 +0200
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!

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#71979; Package guix. (Thu, 18 Jul 2024 21:22:01 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 71979 <at> debbugs.gnu.org
Subject: Re: bug#71979: (file-name->module-name (location-file
 (package-location pkg))) returns wrong module
Date: Thu, 18 Jul 2024 23:21:32 +0200
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 16 Aug 2024 11:24:10 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Oct 2024 14:48:01 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Tomas Volf <~@wolfsden.cz> to control <at> debbugs.gnu.org. (Sun, 06 Oct 2024 14:49:02 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Oct 2024 14:51:02 GMT) Full text and rfc822 format available.

This bug report was last modified 313 days ago.

Previous Next


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