mcedit problem (2)

murban murban at cs.uni-magdeburg.de
Mon Dec 10 17:15:55 UTC 2001


Hi,

is the following problem known? Sometimes (usually a few times a day :-(
) if I press F4 to edit a .cc file with the internal editor, the
Midnight Commander hangs up. Here is the description of the problem:

The environment:

---
mc version: 4.5.99a
OS        : Linux version 2.4.4-4GB (SuSE 7.2)
machine   : i686 (AMD Athlon 700)
compiler  : gcc version 2.95.3 20010315 (SuSE)
---

The configuration of the Midnight Commander (produced by `configure'):

---
Configuration:

  Source code location:       .
  Compiler:                   gcc
  Compiler flags:             -g -O2 -Wall
  File system:                Midnight Commander Virtual File System
                              tarfs, mcfs, ftpfs, fish
  Screen manager:             SLang (system-installed library) with
terminfo
  Install console saver:      yes
  Mouse support:              GPM and xterm
  X11 events support:         no
  Debugger code:              none
  With subshell support:      yes
  Internal editor:            yes
  Install path:               /usr/bin, /usr/lib/mc
---

The program does not crash, it simply is caught in an endless loop. Here
is the stack trace (produced with `gdb /usr/bin/mc 670' while mc was
running):

---
#0  0x4017af04 in read () from /lib/libc.so.6
#1  0x401cb828 in __DTOR_END__ () from /lib/libc.so.6
#2  0x401230b1 in _IO_new_file_underflow () from /lib/libc.so.6
#3  0x401253db in _IO_default_uflow () from /lib/libc.so.6
#4  0x40124573 in __uflow () from /lib/libc.so.6
#5  0x40120616 in getc () from /lib/libc.so.6
#6  0x809bcfd in read_one_line (line=0xbfffcbb0, f=0x8103198) at
syntax.c:405
#7  0x809ca4c in edit_read_syntax_rules (edit=0x8117bd0, f=0x8103198) at
syntax.c:607
#8  0x809d278 in edit_read_syntax_file (edit=0x8117bd0, names=0x0,
syntax_file=0x812c550 "/home/mat/.mc/cedit/Syntax",
editor_file=0x81037e8 "CBuilder.cc", first_line=0x80d0d20 "#include
\"CSyntax.h\"", type=0x0) at syntax.c:925
#9  0x809d4b1 in edit_load_syntax (edit=0x8117bd0, names=0x0, type=0x0)
at syntax.c:993
#10 0x808e73f in edit_init (edit=0x0, lines=23, columns=80,
filename=0x810a4c0 "CBuilder.cc", text=0x0, dir=0x80bae0b "",
text_size=0) at edit.c:564
#11 0x8097fb7 in edit (_file=0x812b468 "CBuilder.cc", line=1) at
editwidget.c:120
#12 0x8051da0 in do_edit_at_line (what=0x812b468 "CBuilder.cc",
start_line=1) at cmd.c:300
#13 0x8051e24 in do_edit (what=0x812b468 "CBuilder.cc") at cmd.c:319
#14 0x8051e8a in edit_cmd (panel=0x80f3f08) at cmd.c:326
#15 0x8053ae4 in edit_panel_cmd () at cmd.c:1142
#16 0x808c00a in buttonbar_callback (h=0x80f2510, bb=0x810a030, msg=5,
par=1004) at widget.c:2257
#17 0x8059986 in dlg_try_hotkey (h=0x80f2510, d_key=1004) at dlg.c:656
#18 0x8059a79 in dlg_key_event (h=0x80f2510, d_key=1004) at dlg.c:699
#19 0x8059dce in dlg_process_event (h=0x80f2510, key=1004,
event=0xbffff714) at dlg.c:827
#20 0x8059e95 in run_dlg (h=0x80f2510) at dlg.c:859
#21 0x806ef9f in setup_panels_and_run_mc () at main.c:2047
#22 0x806f1b6 in do_nc () at main.c:2111
#23 0x806fc43 in main (argc=2, argv=0xbffff7fc) at main.c:2799
#24 0x400d0c6f in __libc_start_main () from /lib/libc.so.6
---

The program is caught in the following loop (syntax.c:404+):

---
404         for (;;) {
405             c = fgetc (f);
406             if (c == EOF) {
407                 if (errno == EINTR)
408                     continue;
---

It tries to read my own `c.syntax' (see the attachment). `c' and `errno'
always have the same values: c is -1 and errno is EINTR. `f' has the
following value (produced with `p *f' in the gdb):

---
$2 = {_flags = -72538984, 
  _IO_read_ptr = 0x40263000 "6\n    keyword %% brightred/16\n    keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_read_end = 0x40263000 "6\n    keyword %% brightred/16\n    keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_read_base = 0x40263000 "6\n    keyword %% brightred/16\n   
keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_write_base = 0x40263000 "6\n    keyword %% brightred/16\n   
keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_write_ptr = 0x40263000 "6\n    keyword %% brightred/16\n   
keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_write_end = 0x40263000 "6\n    keyword %% brightred/16\n   
keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_buf_base = 0x40263000 "6\n    keyword %% brightred/16\n    keyword
%\\[#0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[L\\]\\{eEfgGoxX\\}
brightred/16\n    keyword
%\\[0\\s-\\+,\\]\\[0123456789\\]\\[.\\]\\[0123456789\\]\\[hl\\]\\{diu\\}
brightred/"..., 
  _IO_buf_end = 0x40264000 <Address 0x40264000 out of bounds>,
_IO_save_base = 0x0, _IO_backup_base = 0x0, _IO_save_end = 0x0, _markers
= 0x0, 
  _chain = 0x810a6c0, _fileno = 13, _blksize = 0, _old_offset = 0,
_cur_column = 0, _vtable_offset = 0 '\000', _shortbuf = "", _lock =
0x8103230, 
  _offset = -1, __pad1 = 0x0, __pad2 = 0x8103248, _mode = -1, _unused2 =
'\000' <repeats 51 times>}
---

Here are the files opened by mc (produced with `lsof -u mat'):

---
COMMAND   PID USER   FD   TYPE     DEVICE    SIZE    NODE NAME
mc        670  mat  cwd    DIR        3,9    4096  558577
/home/mat/CParser
mc        670  mat  rtd    DIR        3,9    4096       2 /
mc        670  mat  txt    REG        3,9 1808493  196996 /usr/bin/mc
mc        670  mat  mem    REG        3,9  100793 1310758
/lib/ld-2.2.2.so
mc        670  mat  mem    REG        3,9     246 1081373
/usr/lib/locale/de_DE/LC_IDENTIFICATION
mc        670  mat  mem    REG        3,9      13 1081374
/usr/lib/locale/de_DE/LC_MEASUREMENT
mc        670  mat  mem    REG        3,9      46 1081379
/usr/lib/locale/de_DE/LC_TELEPHONE
mc        670  mat  mem    REG        3,9     149 1081370
/usr/lib/locale/de_DE/LC_ADDRESS
mc        670  mat  mem    REG        3,9      72 1081376
/usr/lib/locale/de_DE/LC_NAME
mc        670  mat  mem    REG        3,9      24 1081378
/usr/lib/locale/de_DE/LC_PAPER
mc        670  mat  mem    REG        3,9      44  786472
/usr/lib/locale/de_DE/LC_MESSAGES/SYS_LC_MESSAGES
mc        670  mat  mem    REG        3,9     280 1081375
/usr/lib/locale/de_DE/LC_MONETARY
mc        670  mat  mem    REG        3,9    2365 1081380
/usr/lib/locale/de_DE/LC_TIME
mc        670  mat  mem    REG        3,9      44 1081377
/usr/lib/locale/de_DE/LC_NUMERIC
mc        670  mat  mem    REG        3,9  423088  327892
/usr/lib/libslang.so.1.4.4
mc        670  mat  mem    REG        3,9   23242  327791
/usr/lib/libgpm.so.1.17.3
mc        670  mat  mem    REG        3,9  170566  327909
/usr/lib/libglib-1.2.so.0.0.10
mc        670  mat  mem    REG        3,9 1343073 1310763 /lib/libc.so.6
mc        670  mat  mem    REG        3,9   14328 1310767
/lib/libdl.so.2
mc        670  mat  mem    REG        3,9  171762 1310768 /lib/libm.so.6
mc        670  mat  mem    REG        3,9  319472 1310793
/lib/libncurses.so.5.2
mc        670  mat  mem    REG        3,9  138560 1081372
/usr/lib/locale/de_DE/LC_CTYPE
mc        670  mat  mem    REG        3,9    5768  852181
/usr/lib/gconv/ISO8859-1.so
mc        670  mat  mem    REG        3,9   57252 1310771
/lib/libnss_compat.so.2
mc        670  mat  mem    REG        3,9   92905 1310770
/lib/libnsl.so.1
mc        670  mat  mem    REG        3,9   76264  590225
/usr/share/locale/de/LC_MESSAGES/mc.mo
mc        670  mat    0u   CHR        4,1           67320 /dev/tty1
mc        670  mat    1u   CHR        4,1           67320 /dev/tty1
mc        670  mat    2u   CHR        4,1           67320 /dev/tty1
mc        670  mat    3w   REG        3,9       0  395093
/home/mat/.mc/tmp/mc-659
mc        670  mat    4u   CHR        5,0           67318 /dev/tty
mc        670  mat    5w  FIFO        0,0            8015 pipe
mc        670  mat    6r  FIFO        0,0            8016 pipe
mc        670  mat    7u   CHR        5,2           66601 /dev/ptmx
mc        670  mat    8w   CHR        4,1           67320 /dev/tty1
mc        670  mat    9r  FIFO        0,0            8021 pipe
mc        670  mat   10w  FIFO        0,0            8021 pipe
mc        670  mat   11u  unix 0xce363ae0            8060 socket
mc        670  mat   12r   REG        3,9    5106 1116903
/home/mat/.mc/cedit/Syntax
mc        670  mat   13r   REG        3,9    4657  624730
/home/mat/.mc/cedit/c.syntax
---

And with `strace -p 670' (670 was the PID of mc) the following list was
produced (endless, here is only one entry):

---
read(13, "", 4096)                      = 0
---

I hope that this is enough :-)))

Unfortunately I don't know who is interrupting `read' all the time. But
I think that the changes I made to `c.syntax' are the reason, but I
can't detect the problem :-( 
It's really nerved because I have to kill the process and restart
Midnight Commander to go on. 

Thanks in advance!
Matthias Urban
-------------- next part --------------
context default
    keyword whole auto green/24
    keyword whole break green/24
    keyword whole case green/24
    keyword whole char green/24
    keyword whole const green/24
    keyword whole continue green/24
    keyword whole default green/24
    keyword whole do green/24
    keyword whole double green/24
    keyword whole else green/24
    keyword whole enum green/24
    keyword whole extern green/24
    keyword whole float green/24
    keyword whole for green/24
    keyword whole goto green/24
    keyword whole if green/24
    keyword whole int green/24
    keyword whole long green/24
    keyword whole register green/24
    keyword whole return green/24
    keyword whole short green/24
    keyword whole signed green/24
    keyword whole sizeof green/24
    keyword whole static green/24
    keyword whole struct green/24
    keyword whole switch green/24
    keyword whole typedef green/24
    keyword whole union green/24
    keyword whole unsigned green/24
    keyword whole void green/24
    keyword whole volatile green/24
    keyword whole while green/24
    keyword whole asm green/24
    keyword whole catch green/24
    keyword whole class green/24
    keyword whole friend green/24
    keyword whole delete green/24
    keyword whole inline green/24
    keyword whole new green/24
    keyword whole operator green/24
    keyword whole private green/24
    keyword whole protected green/24
    keyword whole public green/24
    keyword whole this green/24
    keyword whole throw green/24
    keyword whole template green/24
    keyword whole try green/24
    keyword whole virtual green/24
    keyword whole bool green/24
    keyword whole const_cast green/24
    keyword whole dynamic_cast green/24
    keyword whole explicit green/24
    keyword whole false green/24
    keyword whole mutable green/24
    keyword whole namespace green/24
    keyword whole reinterpret_cast green/24
    keyword whole static_cast green/24
    keyword whole true green/24
    keyword whole typeid green/24
    keyword whole typename green/24
    keyword whole using green/24
    keyword whole wchar_t green/24
    keyword whole ... green/24

    keyword /\* gray/22
    keyword \*/ gray/22

    keyword '\\\{"abtnvfr\}' brightred/16
    keyword '\\\{0123\}\{01234567\}\{01234567\}' brightred/16
    keyword '\\'' brightred/16
    keyword '\\\\' brightred/16
    keyword '\\0' brightred/16
    keyword '\{\s!"#$%&()\*\+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~????????????????????????????????????????????????????????????????????????????????????????????????\}' brightred/16

    keyword :: cyan/14
    keyword -> cyan/14
    keyword >> cyan/14
    keyword << cyan/14
    keyword ++ cyan/14
    keyword -- cyan/14
    keyword != cyan/14
    keyword == cyan/14
    keyword \*= cyan/14
    keyword \+= cyan/14
    keyword /= cyan/14
    keyword -= cyan/14
    keyword %= cyan/14
    keyword >>= cyan/14
    keyword <<= cyan/14
    keyword >= cyan/14
    keyword <= cyan/14
    keyword &= cyan/14
    keyword |= cyan/14
    keyword ^= cyan/14
    keyword && cyan/14
    keyword || cyan/14
    keyword ->\* cyan/14
#    keyword / cyan/24
    keyword \+ cyan/14
    keyword \* cyan/14
    keyword > cyan/14
    keyword < cyan/14
    keyword - cyan/14
    keyword % cyan/14
    keyword = cyan/14
    keyword { cyan/14
    keyword } cyan/14
    keyword ( cyan/15
    keyword ) cyan/15
    keyword [ cyan/14
    keyword ] cyan/14
    keyword , cyan/14
    keyword : cyan/14
    keyword ; cyan/19
    keyword ~ cyan/14
    keyword ^ cyan/14
    keyword . cyan/14
    keyword & cyan/14
    keyword ! cyan/14
    keyword #define\[\t\s\]\[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789\]\[\t\s\]0x\[0123456789abcdefABCDEF\] red/18
context exclusive /\* \*/ gray/22
    spellcheck
context // \n gray/22
    spellcheck
context linestart # \n red/18
    keyword \\\n yellow/24
    keyword /\**\*/ yellow/22
    keyword "+" red/19
    keyword <+> red/19
context " " brown/6
    spellcheck
    keyword \\" brightred/16
    keyword \\\n brightred/16
    keyword %% brightred/16
    keyword %\[#0\s-\+,\]\[0123456789\]\[.\]\[0123456789\]\[L\]\{eEfgGoxX\} brightred/16
    keyword %\[0\s-\+,\]\[0123456789\]\[.\]\[0123456789\]\[hl\]\{diu\} brightred/16
    keyword %\[hl\]n brightred/16
    keyword %\[.\]\[0123456789\]s brightred/16
    keyword %[*] brightred/16
    keyword %c brightred/16
    keyword \\\{0123\}\{01234567\}\{01234567\} brightred/16
#    keyword \\\x\[0123456789abcdefABCDEF\]+  brightred/16
    keyword \\\\ brightred/16
    keyword \\' brightred/16
    keyword \\\{abtnvfr\} brightred/16




More information about the mc-devel mailing list