unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace.
       [not found] ` <20220922135358.22139-1-whatson@gmail.com>
@ 2022-10-12 20:34   ` Ludovic Courtès
       [not found]   ` <87czawvl0v.fsf@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2022-10-12 20:34 UTC (permalink / raw)
  To: Andrew Whatson; +Cc: 57948, guile-devel

Hi Andrew,

Andrew Whatson <whatson@gmail.com> skribis:

> Workaround for <https://bugs.gnu.org/57948>.
>
> * module/system/vm/frame.scm (frame-call-representation): Treat a
> binding as "unspecified" if its slot exceeds 'frame-num-locals'.

Yay, great to see that fixed (or almost)!

It would be great if you could add a simple test case though, so that
the bug doesn’t eventually come back to haunt us.

Could you send an updated patch?

Thanks,
Ludo’.

PS: BTW, it’ll be great to have more patches from you!  :-) To that end,
    please check out the new Guile copyright policy and let us know what
    option you’d like to choose:
    <https://lists.gnu.org/archive/html/guile-devel/2022-10/msg00008.html>.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace.
       [not found]   ` <87czawvl0v.fsf@gnu.org>
@ 2022-10-13  3:36     ` Andrew Whatson
       [not found]     ` <CAPE069eQb3Yg9OdgjBw3tC2c-G2Cbo15rjkdjP=uQgvu_MNjpA@mail.gmail.com>
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Andrew Whatson @ 2022-10-13  3:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57948, guile-devel

Ludovic Courtès <ludo@gnu.org> wrote:
>
> It would be great if you could add a simple test case though, so that
> the bug doesn’t eventually come back to haunt us.
>
> Could you send an updated patch?

Ah yes, getting this covered in a test is on my list.  I had trouble
writing a reproducer previously, I think the bug might only occur in a
nested compilation context (top-level error compiling a dependency
module), but I'll have another go.

> PS: BTW, it’ll be great to have more patches from you!  :-) To that end,
>     please check out the new Guile copyright policy and let us know what
>     option you’d like to choose:
>     <https://lists.gnu.org/archive/html/guile-devel/2022-10/msg00008.html>.

I have already assigned copyright of my work on Guile to the FSF,
happy for that to remain.

That said, I'm glad to see this requirement being eased!

Cheers,
Andrew





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace.
       [not found]     ` <CAPE069eQb3Yg9OdgjBw3tC2c-G2Cbo15rjkdjP=uQgvu_MNjpA@mail.gmail.com>
@ 2022-10-13 13:09       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2022-10-13 13:09 UTC (permalink / raw)
  To: Andrew Whatson; +Cc: 57948, guile-devel

Hi,

Andrew Whatson <whatson@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> wrote:
>>
>> It would be great if you could add a simple test case though, so that
>> the bug doesn’t eventually come back to haunt us.
>>
>> Could you send an updated patch?
>
> Ah yes, getting this covered in a test is on my list.  I had trouble
> writing a reproducer previously, I think the bug might only occur in a
> nested compilation context (top-level error compiling a dependency
> module), but I'll have another go.

Awesome.

>> PS: BTW, it’ll be great to have more patches from you!  :-) To that end,
>>     please check out the new Guile copyright policy and let us know what
>>     option you’d like to choose:
>>     <https://lists.gnu.org/archive/html/guile-devel/2022-10/msg00008.html>.
>
> I have already assigned copyright of my work on Guile to the FSF,
> happy for that to remain.

Oh sorry I had overlooked that, perfect!

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace.
       [not found]   ` <87czawvl0v.fsf@gnu.org>
  2022-10-13  3:36     ` Andrew Whatson
       [not found]     ` <CAPE069eQb3Yg9OdgjBw3tC2c-G2Cbo15rjkdjP=uQgvu_MNjpA@mail.gmail.com>
@ 2023-01-11  5:24     ` Andrew Whatson
       [not found]     ` <CAPE069deSOMm8ZoDRd_opj46Rn_0UX3T0uhRUw0xL71QPQsWWg@mail.gmail.com>
  3 siblings, 0 replies; 6+ messages in thread
From: Andrew Whatson @ 2023-01-11  5:24 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57948, guile-devel

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Ludovic Courtès <ludo@gnu.org> wrote:
>
> It would be great if you could add a simple test case though, so that
> the bug doesn’t eventually come back to haunt us.

I've finally tracked this one down, a patch with a unit test for this
bug is attached.

Cheers,
Andrew

[-- Attachment #2: test-frame-local-ref-error.patch --]
[-- Type: text/x-patch, Size: 2111 bytes --]

commit 164bdce6acf53796cb96ef1930a89c6caf84bc39
Author: Andrew Whatson <whatson@gmail.com>
Date:   Wed Jan 11 14:04:32 2023 +1000

    Test for 'frame-local-ref' errors when printing backtrace.
    
    This test reproduces the error from <https://bugs.gnu.org/56493>, and
    passes with the workaround which was merged in commit
    c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a.
    
    * test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New
    test.

diff --git a/test-suite/tests/eval.test b/test-suite/tests/eval.test
index 9d20812f2..316153385 100644
--- a/test-suite/tests/eval.test
+++ b/test-suite/tests/eval.test
@@ -22,6 +22,7 @@
   :use-module ((system vm vm) :select (call-with-stack-overflow-handler))
   :use-module ((system vm frame) :select (frame-call-representation))
   :use-module (ice-9 documentation)
+  :use-module (ice-9 exceptions)
   :use-module (ice-9 local-eval))
 
 
@@ -387,7 +388,27 @@
       (and (eq? (car (frame-call-representation (car frames)))
                 'make-stack)
            (eq? (car (frame-call-representation (car (last-pair frames))))
-                'with-exception-handler)))))
+                'with-exception-handler))))
+
+  (pass-if "avoid frame-local-ref out of range"
+    (with-exception-handler
+        (lambda (ex)
+          ;; If frame-call-representation fails, we'll catch that
+          ;; instead of the expected "Wrong type to apply" error.
+          (string-prefix? "Wrong type to apply" (exception-message ex)))
+      (lambda ()
+        (with-exception-handler
+            (lambda (ex)
+              (let* ((stack (make-stack #t))
+                     (frames (stack->frames stack)))
+                (for-each frame-call-representation frames))
+              (raise-exception ex))
+          (lambda ()
+            ;; This throws a "Wrong type to apply" error, creating a
+            ;; frame with an incorrect number of local slots as
+            ;; described in bug <https://bugs.gnu.org/56493>.
+            (primitive-eval '(define foo (#t))))))
+      #:unwind? #t)))
 
 ;;;
 ;;; letrec init evaluation

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace.
       [not found]     ` <CAPE069deSOMm8ZoDRd_opj46Rn_0UX3T0uhRUw0xL71QPQsWWg@mail.gmail.com>
@ 2023-01-11 23:03       ` Ludovic Courtès
       [not found]       ` <87sfggishx.fsf@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2023-01-11 23:03 UTC (permalink / raw)
  To: Andrew Whatson; +Cc: lloda, 57948-done, guile-devel

Hi,

Andrew Whatson <whatson@gmail.com> skribis:

> commit 164bdce6acf53796cb96ef1930a89c6caf84bc39
> Author: Andrew Whatson <whatson@gmail.com>
> Date:   Wed Jan 11 14:04:32 2023 +1000
>
>     Test for 'frame-local-ref' errors when printing backtrace.
>     
>     This test reproduces the error from <https://bugs.gnu.org/56493>, and
>     passes with the workaround which was merged in commit
>     c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a.
>     
>     * test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New
>     test.

Applied, thanks!

Ludo’.

PS: Please use ‘git format-patch’ so the patch can be directly consumed
    by ‘git am’.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace.
       [not found]       ` <87sfggishx.fsf@gnu.org>
@ 2023-01-12  2:09         ` Andrew Whatson
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Whatson @ 2023-01-12  2:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: lloda, 57948-done, guile-devel

Ludovic Courtès <ludo@gnu.org> wrote:
>
> Applied, thanks!

Thank you!

> PS: Please use ‘git format-patch’ so the patch can be directly consumed
>     by ‘git am’.

My mistake, sorry about that.  Noted for next time :)

Cheers,
Andrew





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-12  2:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <56d1283b-ac09-8f62-8657-de99578e1a6c@telenet.be>
     [not found] ` <20220922135358.22139-1-whatson@gmail.com>
2022-10-12 20:34   ` bug#57948: [PATCH] Avoid 'frame-local-ref' errors when printing backtrace Ludovic Courtès
     [not found]   ` <87czawvl0v.fsf@gnu.org>
2022-10-13  3:36     ` Andrew Whatson
     [not found]     ` <CAPE069eQb3Yg9OdgjBw3tC2c-G2Cbo15rjkdjP=uQgvu_MNjpA@mail.gmail.com>
2022-10-13 13:09       ` Ludovic Courtès
2023-01-11  5:24     ` Andrew Whatson
     [not found]     ` <CAPE069deSOMm8ZoDRd_opj46Rn_0UX3T0uhRUw0xL71QPQsWWg@mail.gmail.com>
2023-01-11 23:03       ` Ludovic Courtès
     [not found]       ` <87sfggishx.fsf@gnu.org>
2023-01-12  2:09         ` Andrew Whatson

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