unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64076: Error message leads user to a false cause of issue
@ 2023-06-14 23:32 Christian Miller via Bug reports for GNU Guix
  0 siblings, 0 replies; only message in thread
From: Christian Miller via Bug reports for GNU Guix @ 2023-06-14 23:32 UTC (permalink / raw)
  To: 64076

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.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-14 23:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 23:32 bug#64076: Error message leads user to a false cause of issue Christian Miller via Bug reports for GNU Guix

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