[vim/vim] internal errors after removing multiline text property (Issue #12568)

10 views
Skip to first unread message

lacygoill

unread,
Jun 20, 2023, 2:36:34 PM6/20/23
to vim/vim, Subscribed

Steps to reproduce

Run this shell command:

vim -Nu NONE -S <(tee <<'EOF'
    vim9script
    var lines =<< trim END
        xxx
        xxx yyy
        yyy
    END
    lines->setline(1)
    prop_type_add('foo', {highlight: 'WarningMsg'})
    prop_add(1, 1, {end_lnum: 2, type: 'foo', end_col: 4})
    prop_type_add('bar', {highlight: 'ErrorMsg'})
    prop_add(2, 5, {end_lnum: 3, type: 'bar', end_col: 4})
    prop_remove({types: prop_type_list()}, 1, 3)
    :2 delete
EOF
)

These internal errors are given:

E340: Internal error; if you can reproduce please report a bug
E685: Internal error: no text property below deleted line

Expected behavior

No internal error is given.

Version of Vim

9.0 Included patches: 1-1640

Environment

Operating system: Ubuntu 20.04.6 LTS
Terminal: XTerm(378)
Value of $TERM: xterm-256color
Shell: GNU bash, version 5.0.17

Valgrind Log

==3080597== Process terminating with default action of signal 6 (SIGABRT)
==3080597==    at 0x5C153DB: kill (syscall-template.S:78)
==3080597==    by 0x2C9A2C: may_core_dump (os_unix.c:3582)
==3080597==    by 0x2C99C7: mch_exit (os_unix.c:3548)
==3080597==    by 0x48333C: getout (main.c:1777)
==3080597==    by 0x2874F2: preserve_exit (misc1.c:2274)
==3080597==    by 0x2C70C2: deathtrap (os_unix.c:1229)
==3080597==    by 0x5C1508F: ??? (in /usr/lib/x86_64-linux-gnu/libc-2.31.so)
==3080597==    by 0x5C1500A: __libc_signal_restore_set (internal-signals.h:86)
==3080597==    by 0x5C1500A: raise (raise.c:48)
==3080597==    by 0x5BF4858: abort (abort.c:79)
==3080597==    by 0x48A24D: siemsg (message.c:881)
==3080597==    by 0x48A2AE: internal_error (message.c:896)
==3080597==    by 0x27A544: adjust_text_props_for_delete (memline.c:3663)
==3080597==    by 0x27AC7B: ml_delete_int (memline.c:3896)
==3080597==    by 0x27AD28: ml_delete_flags (memline.c:3935)
==3080597==    by 0x16C1B4: del_lines (change.c:2389)
==3080597==    by 0x2A8DED: op_delete (ops.c:856)
==3080597==    by 0x1F9962: ex_operators (ex_docmd.c:8036)
==3080597==    by 0x1EEA6C: do_one_cmd (ex_docmd.c:2582)
==3080597==    by 0x1EBBA3: do_cmdline (ex_docmd.c:994)
==3080597==    by 0x335A18: do_source_ext (scriptfile.c:1760)
==3080597==    by 0x336163: do_source (scriptfile.c:1906)
==3080597==    by 0x334AEE: cmd_source (scriptfile.c:1251)
==3080597==    by 0x334BD0: ex_source (scriptfile.c:1277)
==3080597==    by 0x1EEA6C: do_one_cmd (ex_docmd.c:2582)
==3080597==    by 0x1EBBA3: do_cmdline (ex_docmd.c:994)
==3080597==    by 0x1EB02E: do_cmdline_cmd (ex_docmd.c:588)
==3080597==    by 0x485851: exe_commands (main.c:3173)
==3080597==    by 0x481F9B: vim_main2 (main.c:790)
==3080597==    by 0x48183A: main (main.c:441)
==3080597==
==3080597== HEAP SUMMARY:
==3080597==     in use at exit: 431,574 bytes in 1,790 blocks
==3080597==   total heap usage: 3,242 allocs, 1,452 frees, 788,826 bytes allocated
==3080597==
==3080597== 11 bytes in 1 blocks are definitely lost in loss record 61 of 676
==3080597==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3080597==    by 0x14FD80: lalloc (alloc.c:246)
==3080597==    by 0x14FC1F: alloc (alloc.c:151)
==3080597==    by 0x373C67: vim_strsave (strings.c:27)
==3080597==    by 0x489A2C: msg_source (message.c:553)
==3080597==    by 0x489F46: emsg_core (message.c:766)
==3080597==    by 0x48A28B: internal_error (message.c:894)
==3080597==    by 0x27A544: adjust_text_props_for_delete (memline.c:3663)
==3080597==    by 0x27AC7B: ml_delete_int (memline.c:3896)
==3080597==    by 0x27AD28: ml_delete_flags (memline.c:3935)
==3080597==    by 0x16C1B4: del_lines (change.c:2389)
==3080597==    by 0x2A8DED: op_delete (ops.c:856)
==3080597==    by 0x1F9962: ex_operators (ex_docmd.c:8036)
==3080597==    by 0x1EEA6C: do_one_cmd (ex_docmd.c:2582)
==3080597==    by 0x1EBBA3: do_cmdline (ex_docmd.c:994)
==3080597==    by 0x335A18: do_source_ext (scriptfile.c:1760)
==3080597==    by 0x336163: do_source (scriptfile.c:1906)
==3080597==    by 0x334AEE: cmd_source (scriptfile.c:1251)
==3080597==    by 0x334BD0: ex_source (scriptfile.c:1277)
==3080597==    by 0x1EEA6C: do_one_cmd (ex_docmd.c:2582)
==3080597==    by 0x1EBBA3: do_cmdline (ex_docmd.c:994)
==3080597==    by 0x1EB02E: do_cmdline_cmd (ex_docmd.c:588)
==3080597==    by 0x485851: exe_commands (main.c:3173)
==3080597==    by 0x481F9B: vim_main2 (main.c:790)
==3080597==    by 0x48183A: main (main.c:441)


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12568@github.com>

lacygoill

unread,
Jun 20, 2023, 2:43:25 PM6/20/23
to vim/vim, Subscribed

Backtrace:

Program received signal SIGABRT, Aborted.
0x00007ffff6a9000b in raise () from /lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 0x7ffff5c78a80 (LWP 3087268) "vim"):
#0  0x00007ffff6a9000b in raise () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1  0x00007ffff6a6f859 in abort () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#2  0x00005555558d4c15 in siemsg (s=0x555555994e50 <e_internal_error_str> "E685: Internal error: %s") at message.c:881
No locals.
#3  0x00005555558d4c76 in internal_error (where=0x5555558e98f0 "no text property below deleted line") at message.c:896
No locals.
#4  0x00005555556c5bf3 in adjust_text_props_for_delete (buf=0x5555559c42c0, lnum=2, del_props=0x555555a24df0 "\005", del_props_len=20, above=0) at memline.c:3663
        did_get_line = 1
        done_del = 0
        done_this = 1431943792
        prop_del = {tp_col = 5, tp_len = 4, tp_id = 0, tp_type = 2, tp_flags = 1}
        hp = 0x555555a1f6f0
        dp = 0x555555a215c0
        idx = 1
        line_start = 4088
        line_size = 4
        this_props_len = 21845
        text = 0x555555a225b8 "yyy"
        textlen = 4
        found = 1431944513
#5  0x00005555556c632a in ml_delete_int (buf=0x5555559c42c0, lnum=2, flags=1) at memline.c:3896
        hp = 0x555555a1f6f0
        mfp = 0x555555a1d500
        dp = 0x555555a215c0
        pp = 0x5555559c42c0
        ip = 0x2
        count = 3
        idx = 1
        stack_idx = 0
        text_start = 4060
        line_start = 4064
        line_size = 28
        i = 2
        ret = 1
        textprop_save = 0x555555a24df0 "\005"
        textprop_len = 20
#6  0x00005555556c63d7 in ml_delete_flags (lnum=2, flags=1) at memline.c:3935
No locals.
#7  0x00005555555b7cdd in del_lines (nlines=1, undo=1) at change.c:2389
        n = 0
        first = 2
#8  0x00005555556f4451 in op_delete (oap=0x7fffffffacb0) at ops.c:856
        n = 21845
        lnum = 2
        ptr = 0x5555559c42c0 "\002"
        newp = 0x555555a1f6f0 ""
        oldp = 0x1c00000fe0 <error: Cannot access memory at address 0x1c00000fe0>
        bd = {startspaces = 1436685760, endspaces = 21845, textlen = 1432611577, textstart = 0x7fffffffac60 "\220\254\377\377\377\177", textcol = 1435346448, start_vcol = 21845, end_vcol = -21360, is_short = 32767, is_MAX = 1432315876, is_oneChar = 21845, pre_whitesp = -21344, pre_whitesp_c = 1, end_char_vcols = 1436297928, start_char_vcols = 6}
        old_lcount = 3
        did_yank = 1
#9  0x000055555564528e in ex_operators (eap=0x7fffffffadf0) at ex_docmd.c:8036
        oa = {op_type = 1, regname = 0, motion_type = 1, motion_force = 0, use_reg_one = 0, inclusive = 0, end_adjusted = 0, start = {lnum = 2, col = 0, coladd = 0}, end = {lnum = 2, col = 0, coladd = 0}, cursor_start = {lnum = 0, col = 0, coladd = 0}, line_count = 1, empty = 0, is_VIsual = 0, block_mode = 0, start_vcol = 0, end_vcol = 0, prev_opcount = 0, prev_count0 = 0, excl_tr_ws = 0}
#10 0x000055555563a3ef in do_one_cmd (cmdlinep=0x7fffffffb020, flags=7, cstack=0x7fffffffb100, fgetline=0x555555781e29 <getsourceline>, cookie=0x7fffffffb870) at ex_docmd.c:2582
        p = 0x555555a1fe19 ""
        lnum = 0
        n = -72057594037927936
        errormsg = 0x0
        after_modifier = 0x555555a1fe11 "2 delete"
        ea = {arg = 0x555555a1fe19 "", nextcmd = 0x0, cmd = 0x555555a1fe13 "delete", cmdlinep = 0x7fffffffb020, cmdline_tofree = 0x0, cmdidx = CMD_delete, argt = 18351937, skip = 0, forceit = 0, addr_count = 1, line1 = 2, line2 = 2, addr_type = ADDR_LINES, flags = 0, do_ecmd_cmd = 0x0, do_ecmd_lnum = 0, append = 0, usefilter = 0, amount = 0, regname = 0, force_bin = 0, read_edit = 0, force_ff = 0, force_enc = 0, bad_char = 0, useridx = 0, errmsg = 0x0, getline = 0x555555781e29 <getsourceline>, cookie = 0x7fffffffb870, cstack = 0x7fffffffb100}
        save_cmdmod = {cmod_flags = 0, cmod_split = 0, cmod_tab = 0, cmod_filter_regmatch = {regprog = 0x0, startp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, endp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, rm_matchcol = 0, rm_ic = 0}, cmod_filter_force = 0, cmod_verbose = 0, cmod_save_ei = 0x0, cmod_did_sandbox = 0, cmod_verbose_save = 0, cmod_save_msg_silent = 0, cmod_save_msg_scroll = 0, cmod_did_esilent = 0}
        save_reg_executing = 0
        save_pending_end_reg_executing = 0
        ni = 0
        cmd = 0x555555a1fe11 "2 delete"
        starts_with_colon = 1
        may_have_range = 1
        did_set_expr_line = 0
        sourcing = 1
        did_append_cmd = 0
        vim9script = 1
#11 0x0000555555637526 in do_cmdline (cmdline=0x5555559b3060 "vim9script", fgetline=0x555555781e29 <getsourceline>, cookie=0x7fffffffb870, flags=7) at ex_docmd.c:994
        next_cmdline = 0x555555a1fe10 ":2 delete"
        cmdline_copy = 0x555555a1fe10 ":2 delete"
        used_getline = 1
        recursive = 2
        msg_didout_before_start = 0
        count = 11
        did_inc_RedrawingDisabled = 0
        retval = 1
        cstack = {cs_flags = {0 <repeats 50 times>}, cs_pending = '\000' <repeats 49 times>, cs_pend = {csp_rv = {0x0 <repeats 50 times>}, csp_ex = {0x0 <repeats 50 times>}}, cs_forinfo = {0x0 <repeats 50 times>}, cs_line = {0 <repeats 50 times>}, cs_block_id = {0 <repeats 50 times>}, cs_script_var_len = {0 <repeats 50 times>}, cs_idx = -1, cs_looplevel = 0, cs_trylevel = 0, cs_emsg_silent_list = 0x0, cs_lflags = 0 '\000'}
        lines_ga = {ga_len = 0, ga_maxlen = 0, ga_itemsize = 16, ga_growsize = 10, ga_data = 0x0}
        current_line = 0
        current_line_before = 0
        fname = 0x555555a1f730 "/tmp/t.vim"
        breakpoint = 0x7fffffffb8b0
        dbg_tick = 0x7fffffffb8c0
        debug_saved = {trylevel = 0, force_abort = 0, caught_stack = 0x0, vv_exception = 0x0, vv_throwpoint = 0x0, did_emsg = 0, got_int = 0, did_throw = 0, need_rethrow = 0, check_cstack = 0, current_exception = 0x0}
        initial_trylevel = 0
        saved_msg_list = 0x7fffffffbc98
        private_msg_list = 0x0
        cmd_getline = 0x555555781e29 <getsourceline>
        cmd_cookie = 0x7fffffffb870
        cmd_loop_cookie = {lines_gap = 0x0, current_line = 0, repeating = 0, getline = 0x7ffff6f9e520, cookie = 0x7ffff6f776a8 <XtResolvePathname+1752>}
        real_cookie = 0x7fffffffb870
        getline_is_func = 0
        call_depth = 2
#12 0x0000555555780b9a in do_source_ext (fname=0x5555559ca663 "/tmp/t.vim", check_other=0, is_vimrc=0, ret_sid=0x0, eap=0x0, clearvars=0) at scriptfile.c:1760
        cookie = {fp = 0x555555a1ee00, nextline = 0x0, sourcing_lnum = 19, finished = 0, source_from_buf = 0, buf_lnum = 0, buflines = {ga_len = 0, ga_maxlen = 0, ga_itemsize = 0, ga_growsize = 0, ga_data = 0x0}, breakpoint = 0, fname = 0x555555a1f730 "/tmp/t.vim", dbg_tick = 0, level = 1, conv = {vc_type = 0, vc_factor = 0, vc_fd = 0x0, vc_fail = 0}}
        p = 0x0
        fname_not_fixed = 0x555555a225d0 "/tmp/t.vim"
        fname_exp = 0x555555a1f750 "/tmp/t.vim"
        firstline = 0x5555559b3060 "vim9script"
        retval = 0
        save_current_sctx = {sc_sid = -3, sc_seq = 0, sc_lnum = 0, sc_version = 0}
        tv_rel = {tv_sec = 3, tv_usec = 93824996910701}
        tv_start = {tv_sec = 93824997248240, tv_usec = 140737354129808}
        wait_start = {tv_sec = 140733461823488, tv_nsec = 140737316910224}
        save_sticky_cmdmod_flags = 0
        trigger_source_post = 0
        funccalp_entry = {top_funccal = 0x0, next = 0x0}
        save_debug_break_level = -1
        sid = 1
        si = 0x5555559c75d0
        save_estack_compiling = 0
        estack_len_before = 3
        save_KeyTyped = 0
#13 0x00005555557812e5 in do_source (fname=0x5555559ca663 "/tmp/t.vim", check_other=0, is_vimrc=0, ret_sid=0x0) at scriptfile.c:1906
No locals.
#14 0x000055555577fc70 in cmd_source (fname=0x5555559ca663 "/tmp/t.vim", eap=0x7fffffffba60) at scriptfile.c:1251
        clearvars = 0
#15 0x000055555577fd52 in ex_source (eap=0x7fffffffba60) at scriptfile.c:1277
No locals.
#16 0x000055555563a3ef in do_one_cmd (cmdlinep=0x7fffffffbc90, flags=11, cstack=0x7fffffffbd70, fgetline=0x0, cookie=0x0) at ex_docmd.c:2582
        p = 0x5555559ca662 " /tmp/t.vim"
        lnum = 140737331434032
        n = 140737354009498
        errormsg = 0x0
        after_modifier = 0x5555559ca660 "so /tmp/t.vim"
        ea = {arg = 0x5555559ca663 "/tmp/t.vim", nextcmd = 0x0, cmd = 0x5555559ca660 "so /tmp/t.vim", cmdlinep = 0x7fffffffbc90, cmdline_tofree = 0x0, cmdidx = CMD_source, argt = 17563967, skip = 0, forceit = 0, addr_count = 0, line1 = 1, line2 = 1, addr_type = ADDR_LINES, flags = 0, do_ecmd_cmd = 0x0, do_ecmd_lnum = 0, append = 0, usefilter = 0, amount = 0, regname = 0, force_bin = 0, read_edit = 0, force_ff = 0, force_enc = 0, bad_char = 0, useridx = 0, errmsg = 0x0, getline = 0x0, cookie = 0x0, cstack = 0x7fffffffbd70}
        save_cmdmod = {cmod_flags = 0, cmod_split = 0, cmod_tab = 0, cmod_filter_regmatch = {regprog = 0x0, startp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, endp = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, rm_matchcol = 0, rm_ic = 0}, cmod_filter_force = 0, cmod_verbose = 0, cmod_save_ei = 0x0, cmod_did_sandbox = 0, cmod_verbose_save = 0, cmod_save_msg_silent = 0, cmod_save_msg_scroll = 0, cmod_did_esilent = 0}
        save_reg_executing = 0
        save_pending_end_reg_executing = 0
        ni = 0
        cmd = 0x5555559ca660 "so /tmp/t.vim"
        starts_with_colon = 0
        may_have_range = 1
        did_set_expr_line = 0
        sourcing = 1
        did_append_cmd = 0
        vim9script = 0
#17 0x0000555555637526 in do_cmdline (cmdline=0x5555559c7f60 "so /tmp/t.vim", fgetline=0x0, cookie=0x0, flags=11) at ex_docmd.c:994
        next_cmdline = 0x5555559ca660 "so /tmp/t.vim"
        cmdline_copy = 0x5555559ca660 "so /tmp/t.vim"
        used_getline = 0
        recursive = 2
        msg_didout_before_start = 0
        count = 1
        did_inc_RedrawingDisabled = 0
        retval = 1
        cstack = {cs_flags = {0 <repeats 50 times>}, cs_pending = '\000' <repeats 49 times>, cs_pend = {csp_rv = {0x0 <repeats 50 times>}, csp_ex = {0x0 <repeats 50 times>}}, cs_forinfo = {0x0 <repeats 50 times>}, cs_line = {0 <repeats 50 times>}, cs_block_id = {0 <repeats 50 times>}, cs_script_var_len = {0 <repeats 50 times>}, cs_idx = -1, cs_looplevel = 0, cs_trylevel = 0, cs_emsg_silent_list = 0x0, cs_lflags = 0 '\000'}
        lines_ga = {ga_len = 0, ga_maxlen = 0, ga_itemsize = 16, ga_growsize = 10, ga_data = 0x0}
        current_line = 0
        current_line_before = 0
        fname = 0x0
        breakpoint = 0x0
        dbg_tick = 0x0
        debug_saved = {trylevel = 0, force_abort = 0, caught_stack = 0x0, vv_exception = 0x0, vv_throwpoint = 0x0, did_emsg = 0, got_int = 0, did_throw = 0, need_rethrow = 0, check_cstack = 0, current_exception = 0x0}
        initial_trylevel = 0
        saved_msg_list = 0x0
        private_msg_list = 0x0
        cmd_getline = 0x0
        cmd_cookie = 0x0
        cmd_loop_cookie = {lines_gap = 0x7fffffffc0b0, current_line = 529823011, repeating = 0, getline = 0x7e51d4, cookie = 0x7fffffffbd74}
        real_cookie = 0x0
        getline_is_func = 0
        call_depth = 2
#18 0x00005555556369b1 in do_cmdline_cmd (cmd=0x5555559c7f60 "so /tmp/t.vim") at ex_docmd.c:588
No locals.
#19 0x00005555558d0219 in exe_commands (parmp=0x5555559a9540 <params>) at main.c:3173
        i = 0
        estack_len_before = 2
#20 0x00005555558cc9b2 in vim_main2 () at main.c:790
No locals.
#21 0x00005555558cc251 in main (argc=7, argv=0x7fffffffc578) at main.c:441
        i = 7


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12568/1599325644@github.com>

Shane-XB-Qian

unread,
Jun 21, 2023, 1:41:11 AM6/21/23
to vim/vim, Subscribed

i faced similar before,
but sometime suddenly prop_remove() (or prop_clear) would not really remove prop.
// prop list was 0 already, but prop hl still there.

this ticket reproduce code, if no prop_remove it, seems 2delete would be no err, so perhaps same cause?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12568/1600136928@github.com>

LemonBoy

unread,
Aug 14, 2023, 11:24:03 AM8/14/23
to vim/vim, Subscribed

The prop_delete is only deleting the foo tag in line 1+2 then only the second half of bar in line 3, the first half in line 2 is not touched because the code removes at most one prop per line.
By "chopping" the prop this way the internal reprpesentation is corrupted and that's the source of the internal errors.

Side note: the code in prop_delete does not specify what happens when it has to delete props starting before or ending after the specified range of lines.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12568/1677541560@github.com>

Christian Brabandt

unread,
4:51 PM (5 hours ago) 4:51 PM
to vim/vim, Subscribed

Closed #12568 as completed via ff41e9d.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/12568/issue_event/24273309663@github.com>

Reply all
Reply to author
Forward
0 new messages