Ticket #1864 (closed defect: fixed)
4.7.0-pre4 editor crashes in color terminals
Reported by: | yury_t | Owned by: | slavazanko |
---|---|---|---|
Priority: | major | Milestone: | 4.7.0.1 |
Component: | mcedit | Version: | master |
Keywords: | syntax, crash | Cc: | |
Blocked By: | Blocking: | ||
Branch state: | Votes for changeset: | committed-master |
Description (last modified by andrew_b) (diff)
Internal editor crashes MC when running on color terminals. Monochrome terminals (mc -b) work fine. Patch from ticket #1857 was no help.
System is basicly Slackware 12.2. Following are the stack traces of MC 4.7.0-pre4 modified with pacth #1857.
This is stack trace of starting new file (Shift+F4), then saving:
#0 0xb7c39c66 in raise () from /lib/libc.so.6
#1 0xb7c3b571 in abort () from /lib/libc.so.6
#2 0xb7c7260b in libc_message () from /lib/libc.so.6
#3 0xb7c7a564 in _int_free () from /lib/libc.so.6
#4 0xb7c7e010 in free () from /lib/libc.so.6
#5 0xb7d9a046 in g_free () from /usr/lib/libglib-2.0.so.0
#6 0x080a22d5 in edit_read_syntax_file (edit=0x81c4e58, pnames=0x0,
syntax_file=<value optimized out>, editor_file=0x81c2d48 "222",
first_line=0x812d6c0 "222", type=0x0) at syntax.c:748
#7 0x080a3266 in edit_load_syntax (edit=0x81c4e58, pnames=0x0, type=0x0) at syntax.c:1198
#8 0x0809c2be in edit_save_as_cmd (edit=0x81c4e58) at editcmd.c:618
#9 0x0809c3e9 in edit_save_cmd (edit=0x81c4e58) at editcmd.c:866
#10 0x0809623c in edit_execute_cmd (edit=0x81c4e58, command=101, char_for_insertion=-1)
at edit.c:3028
#11 0x08096b70 in edit_execute_key_command (edit=0x81c4e58, command=101, char_for_insertion=-1)
at edit.c:2551
#12 0x0809d6ad in edit_callback (w=0x81c4e58, msg=WIDGET_KEY, parm=1002) at editwidget.c:377
#13 0x0809cf64 in cmd_F2 (edit=0x81c4e58) at ../src/tty/../../src/dialog.h:237
#14 0x08059d1a in buttonbar_call (bb=<value optimized out>, i=<value optimized out>)
at widget.c:2687
#15 0x0805a4b9 in buttonbar_callback (w=0x81bd388, msg=WIDGET_HOTKEY, parm=1002)
at widget.c:2715
#16 0x08050ecb in dlg_process_event (h=0x81a9e00, key=1002, event=0xbff50144)
at ../src/tty/../../src/dialog.h:237
#17 0x08051171 in run_dlg (h=0x81a9e00) at dialog.c:858
#18 0x0809d0d6 in edit_file (_file=0x0, line=0) at editwidget.c:239
#19 0x08072aba in do_edit_at_line (what=0x0, start_line=0) at cmd.c:305
#20 0x08072afe in do_edit (what=0x0) at cmd.c:323
#21 0x080576a4 in panel_key (panel=0x81b3bc8, key=1014) at screen.c:2636
#22 0x08050cb5 in dlg_process_event (h=0x81abf08, key=1014, event=0xbff512c4)
at ../src/tty/../../src/dialog.h:237
#23 0x08051171 in run_dlg (h=0x81abf08) at dialog.c:858
#24 0x0808a071 in do_nc () at main.c:1805
#25 0x0808a789 in main (argc=Cannot access memory at address 0x1
) at main.c:2234
This is stack trace of opening simple (non-syntax-colored) file, then immediately closing it:
#0 0xb7c06c66 in raise () from /lib/libc.so.6
#1 0xb7c08571 in abort () from /lib/libc.so.6
#2 0xb7c3f60b in libc_message () from /lib/libc.so.6
#3 0xb7c47564 in _int_free () from /lib/libc.so.6
#4 0xb7c4b010 in free () from /lib/libc.so.6
#5 0xb7d67046 in g_free () from /usr/lib/libglib-2.0.so.0
#6 0x080a1dcb in edit_free_syntax_rules (edit=0xb7d23ff4) at syntax.c:1005
#7 0x08092880 in edit_clean (edit=0x81c8328) at edit.c:870
#8 0x0809d6cb in edit_callback (w=0x81c8328, msg=WIDGET_INIT, parm=0) at editwidget.c:394
#9 0x0805051d in dlg_broadcast_msg_to (h=<value optimized out>, message=WIDGET_DESTROY,
reverse=0, flags=0) at ../src/tty/../../src/dialog.h:237
#10 0x08050bd6 in destroy_dlg (h=0x81afd50) at dialog.c:884
#11 0x0809d0de in edit_file (_file=0x81a5d30 "222", line=0) at editwidget.c:241
#12 0x08072aba in do_edit_at_line (what=0x81a5d30 "222", start_line=0) at cmd.c:305
#13 0x08072afe in do_edit (what=0x0) at cmd.c:323
#14 0x08059d03 in buttonbar_call (bb=<value optimized out>, i=<value optimized out>)
at widget.c:2684
#15 0x0805a4b9 in buttonbar_callback (w=0x81ad070, msg=WIDGET_HOTKEY, parm=1004)
at widget.c:2715
#16 0x08050ecb in dlg_process_event (h=0x81abf08, key=1004, event=0xbfd20094)
at ../src/tty/../../src/dialog.h:237
#17 0x08051171 in run_dlg (h=0x81abf08) at dialog.c:858
#18 0x0808a071 in do_nc () at main.c:1805
#19 0x0808a789 in main (argc=Cannot access memory at address 0x1
) at main.c:2234
This is output.........
Program received signal SIGSEGV, Segmentation fault.
compare_word_to_right (edit=0x81c8328, i=287,
text=0x69633d01 <Address 0x69633d01 out of bounds>,
whole_left=0x6f6f6f6f <Address 0x6f6f6f6f out of bounds>,
whole_right=0x6f6f6f6f <Address 0x6f6f6f6f out of bounds>, line_start=577728367)
at syntax.c:185
185 if (!*text)
...........and stack trace of opening the file which requires syntax-coloring:
#0 compare_word_to_right (edit=0x81c8328, i=287,
text=0x69633d01 <Address 0x69633d01 out of bounds>,
whole_left=0x6f6f6f6f <Address 0x6f6f6f6f out of bounds>,
whole_right=0x6f6f6f6f <Address 0x6f6f6f6f out of bounds>, line_start=577728367)
at syntax.c:185
#1 0x080a167b in apply_rules_going_right (edit=0x81c8328, i=287, rule=
{keyword = 0, end = 29 '\035', context = 0 '\0', _context = 30 '\036', border = 0 '\0'})
at syntax.c:364
#2 0x080a1b1d in edit_get_rule (edit=0x81c8328, byte_index=287) at syntax.c:457
#3 0x080a33df in edit_get_syntax_color (edit=0x81c8328, byte_index=287, color=0xbfdbf71c)
at syntax.c:505
#4 0x0809df5b in edit_draw_this_line (edit=0x81c8328, b=251, row=8, start_col=0, end_col=95)
at editdraw.c:454
#5 0x0809e614 in edit_render_keypress (edit=0x81c8328) at editdraw.c:640
#6 0x0809d4fd in edit_callback (w=0x81c8328, msg=WIDGET_FOCUS, parm=0) at editwidget.c:368
#7 0x0805057a in dlg_focus (h=0x81a6428) at ../src/tty/../../src/dialog.h:237
#8 0x08050946 in init_dlg (h=0x81a6428) at dialog.c:795
#9 0x080510d1 in run_dlg (h=0x81a6428) at dialog.c:872
#10 0x0809d0d6 in edit_file (_file=0x81ad6c8 "opera6.html", line=0) at editwidget.c:239
#11 0x08072aba in do_edit_at_line (what=0x81ad6c8 "opera6.html", start_line=136086312)
at cmd.c:305
#12 0x08072afe in do_edit (what=0x81c8328 "") at cmd.c:323
#13 0x08059d03 in buttonbar_call (bb=<value optimized out>, i=<value optimized out>)
at widget.c:2684
#14 0x0805a4b9 in buttonbar_callback (w=0x81ad070, msg=WIDGET_HOTKEY, parm=1004)
at widget.c:2715
#15 0x08050ecb in dlg_process_event (h=0x81abf08, key=1004, event=0xbfdbf934)
at ../src/tty/../../src/dialog.h:237
#16 0x08051171 in run_dlg (h=0x81abf08) at dialog.c:858
#17 0x0808a071 in do_nc () at main.c:1805
#18 0x0808a789 in main (argc=Cannot access memory at address 0x1
) at main.c:2234
Attachments
Change History
comment:2 follow-up: ↓ 3 Changed 15 years ago by yury_t
Configure options: ./configure --prefix=/usr \
--with-screen=slang \
--enable-charset \
--with-samba \
--without-x \
--with-gpm-mouse \
Build and install per crash reporting instructions.
Color terminals were: 'linux' (fullscreen console) and 'xterm'.
Attached are four files with gdb 'bt'/'bt full' output. Two files (bt-edit-*) for attempts to open a file 'longer than just few bytes' in 'linux' and 'xterm'. One file (bt-closeedit-xterm.txt) for attempt to close editor on the text 'just few bytes long' in 'xterm'. One file (bt-closeedit-fs.txt) was meant to make similar test in fullscreen, but editor actually when actually starting.
comment:3 in reply to: ↑ 2 Changed 15 years ago by angel_il
Replying to yury_t:
can you try current "master"?
comment:4 Changed 15 years ago by andrew_b
Cannot reproduce.
Please describe step by step how to reproduce this bug. And describe your hardware.
comment:5 Changed 15 years ago by yury_t
Andrew:
What step by step? I hit F4 and MC (4.7.0-pre4) coredumps. Sometimes it lets me edit a little and coredumps on closing the editor.
I thought for a sec my inis were to blame, with legacy entries in them (keys for freebsd terms etc.). Nope.
However, if I try to work in monochrome terminal 'xterm-mono', MC lets me use edit OK.
This is first time in years something on this scale happens, I tell you. And hardware never was an issue with MC.
Weren't gdb traces any help?
However, I'm attaching my dmesg output while I'm trying to try current 'master'. As you may see, it's quite a trivial hardware.
comment:7 Changed 15 years ago by angel_il
sorry, but try "1845_code_cleanup"
in this branch removed some uninitialized string values..
comment:8 Changed 15 years ago by yury_t
I proceeded according to the site's instructions, but I'm not able to see any git changes in that branch, compared to head. I don't know git enough, too.
Seems I'll just have to revert to the last-good version.
comment:9 Changed 15 years ago by angel_il
git pull git checkout -b 1845_code_cleanup origin/1845_code_cleanup ./autogen.sh make src/mc
comment:10 Changed 15 years ago by angel_il
Can you say step by step how to reproduce this bug.
for example:
./configure --prefix=/usr
make
make install
run mc
shift-f4
<segfault>
comment:11 Changed 15 years ago by yury_t
I'm stuck with git process. As I understand it, git didn't report any activity on this 'branch switching'. Is my 'copy' of repository actually 'master' or '1845_code_cleanup'? What do I do next? I proceeded as follows:
$ git clone git://midnight-commander.org/git/mc.git
Initialized empty Git repository in /.site/home/ty/src/mc/mc/.git/
remote: Counting objects: 59627, done.
remote: Compressing objects: 100% (12052/12052), done.
remote: Total 59627 (delta 47697), reused 59337 (delta 47455)
Receiving objects: 100% (59627/59627), 27.45 MiB | 28 KiB/s, done.
Resolving deltas: 100% (47697/47697), done.
$ cd mc
$ git pull
Already up-to-date.
$ git checkout -b 1845_code_cleanup origin/1845_code_cleanup
Branch 1845_code_cleanup set up to track remote branch refs/remotes/origin/1845_code_cleanup.
Switched to a new branch "1845_code_cleanup"
$ git pull
Already up-to-date.
$ git branch
- 1845_code_cleanup master
comment:12 Changed 15 years ago by andrew_b
./configure --<you options here>
make
make install
comment:13 Changed 15 years ago by yury_t
None of this mockery, please. :) I know how to configuremakemakeinstall. I'm just not sure that I have exactly 1845_code_cleanup that is going to be configured, made etc.
comment:14 follow-up: ↓ 15 Changed 15 years ago by andrew_b
- Description modified (diff)
- 1845_code_cleanup
Asterisk marks the current brunch.
comment:15 in reply to: ↑ 14 Changed 15 years ago by andrew_b
s/brunch/branch
comment:16 Changed 15 years ago by yury_t
Having done the git part, as described, I did:
- autogen.sh
- ./configure --prefix=/usr \
--with-screen=slang \
--enable-charset \
--with-samba \
--without-x \
--with-gpm-mouse
- make
- make install
- cd
- mc
- Shift+F4
- Entered qwqwqw
- saved as 444
- got core (gdb output attached as bt1845.txt)
comment:17 Changed 15 years ago by angel_il
Yury we can talk with you by e-mail il.smind@…
comment:18 Changed 15 years ago by angel_il
oops.
Yury we can talk with you by e-mail il.smind@… ?
comment:19 follow-up: ↓ 20 Changed 15 years ago by yury_t
I'm assuming that '...' means this domain. We can talk, of course. Just sent you a msg.
comment:20 in reply to: ↑ 19 Changed 15 years ago by angel_il
Replying to yury_t:
I'm assuming that '...' means this domain. We can talk, of course. Just sent you a msg.
it's trac hide my email... il.smind at gmail com
comment:21 Changed 15 years ago by slavazanko
- Status changed from new to accepted
- Owner set to slavazanko
comment:22 Changed 15 years ago by slyfox
Could you try a patch from #1906 bug? angel_il suspects that corruption is related to this one?
Thanks!
comment:23 follow-up: ↓ 24 Changed 15 years ago by yury_t
It definitely seems now that these editor crashes are eliminated with the #1906 patch! (I told you it's the coloured syntax processing :)
Thanks all for your efforts!
I was testing with checkout of 1906_crash_on_syntax and #1906 patch. If of importance, the configure parameters were:
--prefix=/usr --with-screen=slang --enable-charset \ --with-samba --without-x --with-gpm-mouse
comment:24 in reply to: ↑ 23 Changed 15 years ago by slyfox
- Status changed from accepted to testing
- Blocked By 1906 added
- Version changed from 4.7.0-pre4 to master
- Milestone changed from 4.7 to 4.7.1
- Keywords syntax, crash added
- Resolution set to fixed
Replying to yury_t:
It definitely seems now that these editor crashes are eliminated with the #1906 patch! (I told you it's the coloured syntax processing :)
Heh, true. One of compatibility paths to Syntax was handles incorrectly. Fresh mc users won't suffer from it, so it was hard to reproduce.
Thanks again!
Merged as changeset:4c8dbd8f3bf7456de818ef272e5ca2dce5c6a6ce (as #1906 bug)
comment:25 Changed 15 years ago by andrew_b
- Status changed from testing to closed
- Blocked By 1906 removed
- Milestone changed from 4.7.1 to 4.7.0.1
comment:26 Changed 15 years ago by andrew_b
- Votes for changeset set to commited-master
- severity changed from no branch to merged
Which color terminals do you mean?
Please build MC with full debug info (see Report crashes) and attach results in this ticket.