emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#23821: closed (Misleading error for optargs)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#23821: closed (Misleading error for optargs)
Date: Tue, 28 Feb 2017 21:04:02 +0000

Your message dated Tue, 28 Feb 2017 22:03:10 +0100
with message-id <address@hidden>
and subject line Re: bug#23821: Misleading error for optargs
has caused the debbugs.gnu.org bug report #23821,
regarding Misleading error for optargs
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
23821: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23821
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Misleading error for optargs Date: Wed, 22 Jun 2016 05:03:59 +0000 (UTC)
The following program returns a confusing error with guile 2.0.11

  (use-modules (ice-9 optargs)) 
  (define* (func A #:key B) 
     #t) 
  (func 1 2)

When run with auto-compilation on, it gives a valid warning during the 
compilation
step but returns a confusing warning at runtime.

;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 
;;;       or pass the --no-auto-compile argument to disable. 
;;; compiling /home/mike/Projects/pip-tui/pip-tui/bug.scm 
;;; /home/mike/Projects/pip-tui/pip-tui/bug.scm:6:0: warning: wrong number of 
arguments to `func' 
;;; compiled 
/home/mike/.cache/guile/ccache/2.0-LE-8-2.0/home/mike/Projects/pip-tui/pip-tui/bug.scm.go
 
Backtrace: 
In ice-9/boot-9.scm: 
157: 7 [catch #t #<catch-closure 56422c2dade0> ...] 
In unknown file: 
?: 6 [apply-smob/1 #<catch-closure 56422c2dade0>] 
In ice-9/boot-9.scm: 
63: 5 [call-with-prompt prompt0 ...] 
In ice-9/eval.scm: 
432: 4 [eval # #] 
In ice-9/boot-9.scm: 
2401: 3 [save-module-excursion #<procedure 56422c2f6a00 at 
ice-9/boot-9.scm:4045:3 ()>] 
4052: 2 [#<procedure 56422c2f6a00 at ice-9/boot-9.scm:4045:3 ()>] 
In unknown file: 
?: 1 [load-compiled/vm 
"/home/mike/.cache/guile/ccache/2.0-LE-8-2.0/home/mike/Projects/pip-tui/pip-tui/bug.scm.go"]
 
In /home/mike/Projects/pip-tui/pip-tui/bug.scm: 
3: 0 [func 1 #<undefined> 2] 

/home/mike/Projects/pip-tui/pip-tui/bug.scm:3:0: In procedure func: 
/home/mike/Projects/pip-tui/pip-tui/bug.scm:3:0: Error while printing exception



When run with GUILE_AUTO_COMPILE=0 it returns an intelligible warning:

Backtrace: 
In ice-9/boot-9.scm: 
157: 9 [catch #t #<catch-closure 560f68600020> ...] 
In unknown file: 
?: 8 [apply-smob/1 #<catch-closure 560f68600020>] 
In ice-9/boot-9.scm: 
63: 7 [call-with-prompt prompt0 ...] 
In ice-9/eval.scm: 
432: 6 [eval # #] 
In ice-9/boot-9.scm: 
2401: 5 [save-module-excursion #<procedure 560f68620a00 at 
ice-9/boot-9.scm:4045:3 ()>] 
4052: 4 [#<procedure 560f68620a00 at ice-9/boot-9.scm:4045:3 ()>] 
1724: 3 [%start-stack load-stack ...] 
1729: 2 [#<procedure 560f68638fc0 ()>] 
In unknown file: 
?: 1 [primitive-load "/home/mike/Projects/pip-tui/pip-tui/bug.scm"] 
?: 0 [scm-error keyword-argument-error "eval" "Invalid keyword" () (2)] 

ERROR: In procedure scm-error: 
ERROR: Invalid keyword: 2



I can create some improvement by replacing the 'keyword-error-printer'
procedure in ice-9/boot-9.scm with the following
but I don't think that is the correct answer.

--- ice-9/boot-9.scm.0  2016-06-22 00:37:38.929112125 -0400 
+++ ice-9/boot-9.scm    2016-06-22 01:02:11.032206795 -0400 
@@ -1020,8 +1020,10 @@ 

(define (keyword-error-printer port key args default-printer) 
(let ((message (cadr args)) 
-          (faulty  (car (cadddr args)))) ; I won't do it again, I promise. 
-      (format port "~a: ~s" message faulty))) 
+          (faulty (cadddr args))) 
+      (if (pair? faulty) 
+          (format port "~a: ~s" message (car faulty)) 
+          (format port "~a" message)))) 



--- End Message ---
--- Begin Message --- Subject: Re: bug#23821: Misleading error for optargs Date: Tue, 28 Feb 2017 22:03:10 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
On Wed 22 Jun 2016 07:03, Mike Gran <address@hidden> writes:

> The following program returns a confusing error with guile 2.0.11
>
>   (use-modules (ice-9 optargs)) 
>   (define* (func A #:key B) 
>      #t) 
>   (func 1 2)

I have now fixed this in 2.0 and master.  In master it led me to
discover a pretty serious bug.  Now what you get at run-time is:

  address@hidden:~/src/guile$ meta/guile /tmp/foo.scm
  ;;; note: source file /tmp/foo.scm
  ;;;       newer than compiled 
/home/wingo/src/guile/cache/guile/ccache/2.2-LE-8-3.9/tmp/foo.scm.go
  ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
  ;;;       or pass the --no-auto-compile argument to disable.
  ;;; compiling /tmp/foo.scm
  ;;; /tmp/foo.scm:4:4: warning: wrong number of arguments to `func'
  ;;; compiled 
/home/wingo/src/guile/cache/guile/ccache/2.2-LE-8-3.9/tmp/foo.scm.go
  Backtrace:
             6 (apply-smob/1 #<catch-closure 8730a0>)
  In ice-9/boot-9.scm:
      713:2  5 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
  In ice-9/eval.scm:
      619:8  4 (_ #(#(#<directory (guile-user) 8eb6c0>)))
  In ice-9/boot-9.scm:
     2346:4  3 (save-module-excursion _)
    3843:12  2 (_)
  In /tmp/foo.scm:
        4:4  1 (_)
        2:0  0 (func _ #:B _)

  /tmp/foo.scm:2:0: In procedure func:
  /tmp/foo.scm:2:0: Invalid keyword: 2

Which seems OK.

Andy


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]