GNU bug report logs - #46241
Guile Macros did not print the error-line-number ?

Previous Next

Package: guix;

Reported by: Joshua Branson <jbranso <at> dismail.de>

Date: Mon, 1 Feb 2021 18:13:02 UTC

Severity: normal

To reply to this bug, email your comments to 46241 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#46241; Package guix. (Mon, 01 Feb 2021 18:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joshua Branson <jbranso <at> dismail.de>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 01 Feb 2021 18:13:02 GMT) Full text and rfc822 format available.

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

From: Joshua Branson <jbranso <at> dismail.de>
To: bug-guix <at> gnu.org
Cc: bug-guile <at> gnu.org
Subject: Guile Macros did not print the error-line-number ?
Date: Mon, 01 Feb 2021 13:12:42 -0500
Hello!

Recently on irc, I posted an example of an incorrectly used
define-record-type* NOT displaying an error line number.

mdevos mentioned that this could potentially be fixed in (guix
records), but it may also be a guile compile bug as well.

First here is a (guix records) example:

#+BEGIN_SRC scheme
(use-modules (guix records))

(define-record-type* <sway-bindsym>
  sway-bindsym make-sway-bindsym
  sway-bindsym?
  (key-combo sway-bindsym-key-combo
             (default "")))

(display sway-bindsym)  ;; compile error at unknown location
;; (display (sway-bindsym))  this is one "correct" way to call this code
#+END_SRC

One will get a compile error like the following

#+BEING_SRC sh 
;;; note: source file /home/joshua/prog/guile/test.scm
;;;       newer than compiled /home/joshua/.cache/guile/ccache/3.0-LE-8-4.4/home/joshua/prog/guile/test.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/joshua/prog/guile/test.scm
;;; WARNING: compilation of /home/joshua/prog/guile/test.scm failed:
;;; Syntax error:
;;; unknown location: source expression failed to match any pattern in form sway-bindsym
ice-9/psyntax.scm:2800:12: In procedure syntax-violation:
Syntax error:
unknown location: source expression failed to match any pattern in form sway-bindsym
#+END_SRC

As you can see, you do NOT see a error-line-number.  If this file was
sufficiently large, this might be hard to track down.  Though it IS
NICE to see that the error comes from an "sway-bindsym".

mdevos then mentioned that I should provide a simple use case NOT
involving (guix records).  Here is one:

#+BEGIN_SRC scheme
(define-syntax when
  (syntax-rules ()
    ((when condititon exp ...)
     (if condititon
         (begin exp ...)))))

(when #t (display "Hello\n"))

(display when)
#+END_SRC

The error message looks like:

#+BEGIN_SRC sh
;;; note: source file /home/joshua/prog/guile/macro-bug.scm
;;;       newer than compiled /home/joshua/.cache/guile/ccache/3.0-LE-8-4.4/home/joshua/prog/guile/macro-bug.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/joshua/prog/guile/macro-bug.scm
;;; WARNING: compilation of /home/joshua/prog/guile/macro-bug.scm failed:
;;; Syntax error:
;;; unknown location: source expression failed to match any pattern in form when
Hello
ice-9/psyntax.scm:2800:12: In procedure syntax-violation:
Syntax error:
unknown location: source expression failed to match any pattern in form when
#+END_SRC

Again, I do not see an error-line-number message.

Thanks,

Joshua

P.S. I am no scheme compiler expert.  As far as I know, maybe it's
impossible to display the error-line-number, when you use macros.  I
just heard that few free software users report bugs.  I'm just trying
to be helpful.  :)   I hope I am.




Information forwarded to bug-guix <at> gnu.org:
bug#46241; Package guix. (Fri, 19 Feb 2021 15:15:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: jbranso--- via Bug reports for GNU Guix <bug-guix <at> gnu.org>
Cc: bug-guile <at> gnu.org, Joshua Branson <jbranso <at> dismail.de>,
 46241 <at> debbugs.gnu.org
Subject: Re: bug#46241: Guile Macros did not print the error-line-number ?
Date: Fri, 19 Feb 2021 16:14:07 +0100
Hi Joshua,

jbranso--- via Bug reports for GNU Guix <bug-guix <at> gnu.org> skribis:

> Recently on irc, I posted an example of an incorrectly used
> define-record-type* NOT displaying an error line number.
>
> mdevos mentioned that this could potentially be fixed in (guix
> records), but it may also be a guile compile bug as well.
>
> First here is a (guix records) example:
>
> #+BEGIN_SRC scheme
> (use-modules (guix records))
>
> (define-record-type* <sway-bindsym>
>   sway-bindsym make-sway-bindsym
>   sway-bindsym?
>   (key-combo sway-bindsym-key-combo
>              (default "")))
>
> (display sway-bindsym)  ;; compile error at unknown location
> ;; (display (sway-bindsym))  this is one "correct" way to call this code
> #+END_SRC

Source location info is missing because currently (as of 3.0.5), Guile
keeps location info in the form of “source properties” only for lists.
The ‘sway-bindsym’ symbol above has no associated location info.

This may change in the near future as Andy has been rewriting ‘read’
(the Scheme “parser”) in Scheme, among other things.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#46241; Package guix. (Fri, 19 Feb 2021 15:15:02 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 121 days ago.

Previous Next


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