Bug 68563 - mcedit crashes on startup (segfault)
mcedit crashes on startup (segfault)
Product: Red Hat Linux
Classification: Retired
Component: gpm (Show other bugs)
i386 Linux
high Severity high
: ---
: ---
Assigned To: Eido Inoue
Aaron Brown
Depends On:
Blocks: 67218 79579
  Show dependency treegraph
Reported: 2002-07-11 04:20 EDT by Chris Chabot
Modified: 2005-10-31 17:00 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-06-19 23:33:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Chris Chabot 2002-07-11 04:20:16 EDT
The included mc package in limbo crashes the instant i try to edit a file with it 

to reproduce: 

#> mcedit some_existing_file.txt
(Segfault or freeze using 100% cpu)

I tried to install rh 7.3's version of mc, and it had the same result (even
temporary downgraded slang to try that out). But all to no avail.

Then i remebered i had 'cooled' laying around, a version of / riped from mcedit
(which was riped from cooledit) with some minor modifications. However its a lot
older and has simpler code. (so easier to debug). It can be found at:

I compiled it with -O -ggdb, and gdb'd it. It had exactly the same crash as
mcedit did. (good, simpler compile / code base for me to test on!)

gdb's 'bt' told me it crashed on key.c, line 761, which in source is:

            if (gpm_flag) {
                FD_SET(gpm_fd, &select_set);

After i #define HAVE_LIBGPM  0 in config.h and recompile, it cooled works as
expected. (though without any mouse functionality, cooled 0.5 didnt have xterm
mouse handling yet). So it seems something in the mouse handling / interface of
gpm has broken mcedit / cooled..

So i verified that the same is true for the supplied mc package. I edited
mc-4.5.55/src/key.c line around 722 and commented out the HAVE_LIBGPM part, and
recompiled the package. 

After this mcedit works again, the mouse is functional in xterm's (uses a
different library / call), and the mouse is non functional on the console (as
expected). So it is definatly that call to the FD_SET(gpm_fd, &select_set); in
key.c:722 that kills mcedit on startup.

(I'd love to dig deeper and realy fix it, but my C coding days are 4 years
behind me, so its all a bit rusty) I hope it goes a long way in helping you fix
the problem though
Comment 1 Havoc Pennington 2002-07-11 11:21:36 EDT
Since mc hasn't changed since 7.3, I'll tentatively blame gpm and move it over
Comment 2 Chris Chabot 2002-07-11 13:30:24 EDT
Additional comment:

While tracing through the editor, i noticed that gpm_fd has a value of -2, is
that vallid for a file handle??

gpm_fd is gotton from mcedit's mouse.h, which defines it as a externel int,
gotton from gpm.h

Maybe thats a lead?
Comment 3 Chris Chabot 2003-06-19 23:33:20 EDT
Fixed in current release (4.6.x) in either gpm or mc.. closing bug

Note You need to log in before you can comment on or make changes to this bug.