unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Christian Miller via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 64076@debbugs.gnu.org
Subject: bug#64076: Error message leads user to a false cause of issue
Date: Wed, 14 Jun 2023 23:32:11 +0000	[thread overview]
Message-ID: <yuHUUuTQrm4akal-AMsmxgBAiSlZYWd6Br7fIwoSgsqVpVI6hne7Fd3zRlgnB5_IB-1Zy71AEgs_2YUDur9AQkFfzTn3pXO_olvP3HnCfCY=@proton.me> (raw)

If someone imports a module that has code which requires additional modules to be imported but does not do that, the error message will fool the user that he made a mistake with his own defined modules.

cm@gnu /tmp/bug/demo$ guix build -L /tmp -f example.scm
ice-9/eval.scm:223:20: In procedure proc:
error: emacs-dash: unbound variable
hint: Did you forget `(use-modules (bug demo var))'?

I already have it imported but if I run the following command:
cm@gnu /tmp/bug/demo$ guix build -L /tmp -f var.scm
bug/demo/var.scm:14:22: error: git-fetch: unbound variable
hint: Did you forget a `use-modules' form?

We can see that the actual cause of the problem is that in the imported module (var) we forgot to import (guix git-download).

The original command should directly tell that the user.  I am new to Guile Scheme and created a module with some copy/paste since I was just quickly trying something out and thought I did something wrong how I defined those modules.

Example:
/tmp
├── bug
│   └── demo
│       ├── example.scm
│       └── var.scm

// example.scm
(define-module (bug demo example)
  #:use-module (bug demo var)
  #:use-module (guix packages)
  #:use-module (guix git-download)
  #:use-module (guix build-system emacs)
  #:use-module ((guix licenses) #:prefix license:))

(define-public emacs-solarized-theme
  (package
    (name "emacs-solarized-theme")
    (version "2.0.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/bbatsov/solarized-emacs/")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0l2lcdm2hsjasfkg4rmypa4mvbhglbkkyv0jg88ygc6py9klcccd"))))
    (build-system emacs-build-system)
    (propagated-inputs
     (list emacs-dash))
    (home-page "https://github.com/bbatsov/solarized-emacs")
    (synopsis "Port of the Solarized theme for Emacs")
    (description
     "Solarized for Emacs is a port of the Solarized theme for Vim.  This
package provides a light and a dark variant.")
    (license license:gpl3+)))

emacs-solarized-theme

// var.scm
(define-module (bug demo var)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  ;;#:use-module (guix git-download)
  #:use-module (guix build-system emacs)
  #:use-module ((guix licenses) #:prefix license:)
  #:export (emacs-dash))

(define-public emacs-dash
  (package
    (name "emacs-dash")
    (version "2.19.1")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/magnars/dash.el")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0z6f8y1m9amhg427iz1d4xcyr6n0kj5w7kmiz134p320ixsdnzd8"))))
    (build-system emacs-build-system)
    (arguments
     (list #:tests? #t
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'disable-byte-compile-error-on-warn
                 (lambda _
                   (substitute* "Makefile"
                     (("\\(setq byte-compile-error-on-warn t\\)")
                      "(setq byte-compile-error-on-warn nil)")))))))
    (home-page "https://github.com/magnars/dash.el")
    (synopsis "Modern list library for Emacs")
    (description "This package provides a modern list API library for Emacs.")
    (license license:gpl3+)))

Go to /tmp/bug/demo and run guix build -L /tmp -f example.scm

Note that if you go to var.scm and uncomment line 4, it will build the package.



Also, shouldn't here the correct path be shown where the variable could be imported like it normally does?

demo/var.scm:10:22: error: git-fetch: unbound variable
hint: Did you forget a `use-modules' form?

demo/var.scm:19:18: error: emacs-build-system: unbound variable
hint: Did you forget a `use-modules' form?

Since normally I get the following back:
bug/demo/example.scm:8:3: error: package: unbound variable
hint: Did you forget `(use-modules (guix packages))'?

which makes it really easy to work with it even if you are new to all this stuff.




                 reply	other threads:[~2023-06-14 23:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='yuHUUuTQrm4akal-AMsmxgBAiSlZYWd6Br7fIwoSgsqVpVI6hne7Fd3zRlgnB5_IB-1Zy71AEgs_2YUDur9AQkFfzTn3pXO_olvP3HnCfCY=@proton.me' \
    --to=bug-guix@gnu.org \
    --cc=64076@debbugs.gnu.org \
    --cc=miller.christian@proton.me \
    /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).