bugMIT/GNU Scheme - Bugs: bug #63534, Edwin crashes on certain buffer...

 
 

bug #63534: Edwin crashes on certain buffer content

Submitter:  Taylor R. Campbell <riastradh>
Submitted:  Fri 16 Dec 2022 03:20:41 AM UTC
   
 
Category:  compiler Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect behavior
Status:  Fixed Privacy:  Public
Assigned to:  riastradh Originator Name: 
Open/Closed:  Closed
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 22 Dec 2022 04:48:25 PM UTC, comment #7: 

Found and fixed in https://git.savannah.gnu.org/cgit/mit-scheme.git/commit/?id=a2de4f1e299cf85fc0d7e26ae6ded2a35c2dd34f with tests added.  Should pull up to the release-12 branch (and maybe release-11 if you want to do any more 11.x releases).  Let me know if anything else like this surfaces!

Taylor R. Campbell <riastradh>
Group Member
Wed 21 Dec 2022 07:27:48 AM UTC, comment #6: 

Got a reasonably focused case; see attached file.  It contains lap for the failing procedure, and information about what is passed as arguments and what expected result is.

(file #54134)

Chris Hanson <cph>
Group administrator
Tue 20 Dec 2022 09:19:20 AM UTC, comment #5: 

Yikes.  OK, if you can narrow down a reproducer for the difference, I can take a look at what the compiler's doing differently.  Guessing I probably screwed something up with register homes again.

Taylor R. Campbell <riastradh>
Group Member
Tue 20 Dec 2022 04:41:55 AM UTC, comment #4: 

This appears to be a bug in the compiler.  When run interpreted, or compiled on aarch64le, the problem doesn't occur.

The root cause of the crash is that the redisplay is being re-entered before it is finished, and the data structures are in an inconsistent state.  I can't see a path by which this can happen.

I'll put some more time into this soon, but I may need some help from you at some point.

Chris Hanson <cph>
Group administrator
Sat 17 Dec 2022 03:17:40 AM UTC, comment #3: 

OK, I've reproduced the bug. Thank you.

Chris Hanson <cph>
Group administrator
Fri 16 Dec 2022 03:20:16 PM UTC, comment #2: 

Sorry, yes, I meant M->, not C-x >.

This on amd64.  I removed my .edwin to test, but forgot about .Xdefaults, which has this:

edwin.font:                     10x20

(The only local changes I have are something in cmpauxmd/aarch64.m4, not relevant on x86, and a definition of flo:log+exp in runtime/arith.scm, neither of which should affect this.)

This should be a clean cross-build from 10.1.11.

Taylor R. Campbell <riastradh>
Group Member
Fri 16 Dec 2022 05:27:18 AM UTC, comment #1: 

I assume you mean M-> rather than C-x >, since the latter has no binding.

I just tried this on a master build for x86_64 without any errors.

What arch are you using and what is the size of the editor screen? Any other relevant info I might need?

Chris Hanson <cph>
Group administrator
Fri 16 Dec 2022 03:20:41 AM UTC, original submission:  

Opening the attached bad.scm and typing C-x > to go to the end of the buffer reliably, and apparently unrecoverably, crashes Edwin from master with the following error:


;The object -3, passed as an argument to vector-8b-ref, is not the correct type.
;To continue, call RESTART with an option number:
; (RESTART 3) => Return to the editor command loop.
; (RESTART 2) => Return to command level 2.
; (RESTART 1) => Return to read-eval-print level 1.
;package: (user)

3 error> (debug)

There are more than 50 subproblems on the stack.

Subproblem level: 0 (this is the lowest subproblem level)
Compiled code expression (from stack):
    (begin
     <!>
     (if (not (index-fixnum? index))
         (error:not-a index-fixnum? index 'vector-8b-ref))
     (if (not (less-than-fixnum? index (primitive-datum-ref string 1)))
         (error:bad-range-argument index 'vector-8b-ref))
     (primitive-byte-ref string (plus-fixnum byte0-index index)))
 subproblem being executed (marked by <!>):
    (if (not ((named-lambda (string? object) (or ... ... ...)) string))
        (error:not-a string? string 'vector-8b-ref))
Environment created by the procedure: VECTOR-8B-REF

 applied to: ("fffffffffffffffffffffffffffffffffffftttf" -3)
There is no execution history for this subproblem.
You are now in the debugger.  Type q to quit, ? for commands.

4 debug> h
SL#  Procedure-name          Expression

0    vector-8b-ref           (begin (if (not ((named-lambda (string? object ...
1                            (eq? 116 (vector-8b-ref (%record-ref new-matri ...
2                            (begin (let ((full-line? (and (eq? xl 0) (eq?  ...
3    loop                    (let ((end-index* (or (next-specific-property- ...
4                            (begin (draw-region! window group start-index  ...
5                            (begin (generate-outlines window start end) (s ...
6    update-outlines!        (begin (%recache-window-buffer-local-variables ...
7    update-buffer-wi ...    (begin (if (vector-ref window 23) (update-over ...
8                            (and (or (not xi) ((named-lambda (clip-window- ...
9    :update-display!        (begin (update-inferior! (vector-ref window 8) ...
10                           (and (or (not xi) ((named-lambda (clip-window- ...
11   loop                    (and (update-inferior! (car inferiors) screen  ...
12                           (and (or (not xi) ((named-lambda (clip-window- ...
13   loop                    (and (update-inferior! (car inferiors) screen  ...
14   editor-frame-upd ...    (let ((finished? (window-update-display! windo ...
15                           (and (thunk) (if (memq (%record-ref screen 20) ...
16                           (let ((result (thunk))) (set! finished? result ...
17                           ;compiled code
18                           (let ((finished? ((%record-ref screen 14) scre ...
19                           ;compiled code
20   loop                    (and (update-screen! (car screens) display-sty ...
21   maybe-debug-sche ...    (begin (let ((p (%record-ref (or (name->variab ...
22                           ;compiled code
23                           (begin (if (let ((types (general-car-cdr frame ...
24                           (begin (signal-condition condition) (default-h ...
25                           (begin (handler continuation) (default-error-h ...
26                           (%record-ref #f 2)
27   loop                    ;compiled code
28                           (if (scroll-lines-up window start end y) (begi ...
29   update-outlines!        (begin (%recache-window-buffer-local-variables ...
30   update-buffer-wi ...    (begin (if (vector-ref window 23) (update-over ...
31                           (and (or (not xi) ((named-lambda (clip-window- ...
32   :update-display!        (begin (update-inferior! (vector-ref window 8) ...
33                           (and (or (not xi) ((named-lambda (clip-window- ...
34   loop                    (and (update-inferior! (car inferiors) screen  ...
35   editor-frame-upd ...    (let ((finished? (window-update-display! windo ...
36                           (and (thunk) (if (memq (%record-ref screen 20) ...
37                           (let ((result (thunk))) (set! finished? result ...
38                           ;compiled code
39                           (let ((finished? ((%record-ref screen 14) scre ...
40                           ;compiled code
41   loop                    (and (update-screen! (car screens) display-sty ...
42                           (begin (if (not (peek-no-hang 0)) (begin (if ( ...
43   loop                    (let ((input (thunk))) (if (simple-event-handl ...
44   keyboard-read-1         (remap-alias-key (handle-simple-events (lambda ...
45   keyboard-read           (let ((key (keyboard-read-1 (%record-ref curre ...
46                           ;compiled code
47                           (let ((input (get-next-keyboard-char))) (if (i ...
48                           ;compiled code
49                           (begin (bind-abort-editor-command (lambda () ( ...
50                           ;compiled code
51                           ;compiled code
52                           ;compiled code
53                           ;compiled code
54                           ;compiled code
55                           ;compiled code
56                           ;compiled code
57                           ;compiled code
58                           (begin (bind-condition-handler (cons condition ...
59                           ;compiled code
60                           ;compiled code
61   loop                    (loop (bind-abort-restart cmdl (lambda () (wit ...
62                           ;compiled code
63                           ;compiled code
64                           ;compiled code
65                           ;compiled code
66                           ;compiled code
67                           ;compiled code
68                           ;compiled code
69   map-1                   (begin (procedure (car l)) (map-1 (cdr l)))
70                           (begin (process-keyword (vector->list unused)  ...
71                           ;compiled code
72                           (begin (apply (car receivers) (cdr event)) (#[ ...
73                           (begin (procedure item) (loop))
74                           ;compiled code
75   map-1                   (begin (procedure (car l)) (map-1 (cdr l)))
76                           ;compiled code
77                           (begin (unblock-thread-events) (ignore-errors  ...
78                           ;compiled code
79   loop                    (loop (bind-abort-restart cmdl (lambda () (wit ...
80                           ;compiled code
81                           ;compiled code
82                           ;compiled code

4 debug> u
Subproblem level: 1
Compiled code expression (from stack):
    (eq? 116 <!>)
 subproblem being executed (marked by <!>):
    (vector-8b-ref (%record-ref new-matrix 3) y)
Environment created by a LET special form

 applied to: (#t)
There is no execution history for this subproblem.

4 debug> a
----------------------------------------
Environment created by a LET special form
Depth (relative to initial environment): 0
 has bindings:

full-line? = #t


----------------------------------------
Environment created by a LET special form
Depth (relative to initial environment): 1
 has bindings:

new-matrix = #[matrix 12]


----------------------------------------
Environment created by the procedure: SCREEN-GET-OUTPUT-LINE
Depth (relative to initial environment): 2
 has bindings:

face = #f
screen = #[screen 13]
xl = 0
xu = 80
y = -3


----------------------------------------
Environment named: (edwin screen)
Depth (relative to initial environment): 3


----------------------------------------
Environment named: (edwin)
Depth (relative to initial environment): 4


----------------------------------------
Environment named: ()
Depth (relative to initial environment): 5

4 debug> g

Subproblem number (minimum 0): 26

Subproblem level: 26
Expression (from stack):
    (%record-ref #f 2)
There is no current environment.
There is no execution history for this subproblem.

4 debug> u
Subproblem level: 27
Compiled code expression unknown
#[compiled-return-address 14 ("bufwfs" #x6) #x1032 #x209c17a]
Environment created by the procedure: LOOP

 applied to: (#f 989 -3)
There is no execution history for this subproblem.

4 debug> a
----------------------------------------
Environment created by the procedure: LOOP
Depth (relative to initial environment): 0
 has bindings:

index = 989
new-start-y = -3
outline = #f


----------------------------------------
Environment created by a LET special form
Depth (relative to initial environment): 1
 has bindings:

amount = 29
start-outline = #[outline 15index: 14 y: 1]


----------------------------------------
Environment created by the procedure: SCROLL-LINES-UP
Depth (relative to initial environment): 2
 has bindings:

end = #[o3 16index: 1511 y: 38 #[outline 17index: 0 y: 1]]
new-start-y = -29
start = #[o3 18index: 0 y: 0 #[outline 15index: 14 y: 1]]
window = #0=#(#[class 19] #1=#(#[class 20] #2=#(#[class 21] #3=#(#[class 22 ...


----------------------------------------
Environment named: (edwin window)
Depth (relative to initial environment): 3


----------------------------------------
Environment named: (edwin)
Depth (relative to initial environment): 4


----------------------------------------
Environment named: ()
Depth (relative to initial environment): 5

4 debug>


Taylor R. Campbell <riastradh>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #54134:  cwr2.scm added by cph (26KiB - text/x-scheme)
file #54107:  bad.scm added by riastradh (2KiB - text/x-scheme)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cph (Posted a comment)
  • -email is unavailable- added by riastradh (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-22 riastradh StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2022-12-22 cph Assigned tocph riastradh
    2022-12-21 cph Attached File- Added cwr2.scm, #54134
    2022-12-20 riastradh Categoryedwin compiler
        StatusNeed Info In Progress
    2022-12-20 riastradh Categorycompiler edwin
        StatusIn Progress Need Info
    2022-12-20 cph Categoryedwin compiler
    2022-12-17 cph StatusNeed Info In Progress
    2022-12-16 cph StatusNone Need Info
        Assigned toNone cph
    2022-12-16 riastradh Attached File- Added bad.scm, #54107

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code