Bug 68563 - mcedit crashes on startup (segfault)
Summary: mcedit crashes on startup (segfault)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gpm
Version: 8.0
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks: 67218 79579
TreeView+ depends on / blocked
 
Reported: 2002-07-11 08:20 UTC by Chris Chabot
Modified: 2005-10-31 22:00 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-06-20 03:33:20 UTC
Embargoed:


Attachments (Terms of Use)

Description Chris Chabot 2002-07-11 08:20:16 UTC
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:
http://cooled.sourceforge.net/

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:

#ifdef HAVE_LIBGPM
            if (gpm_flag) {
                FD_SET(gpm_fd, &select_set);
            }
#endif

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 15:21:36 UTC
Since mc hasn't changed since 7.3, I'll tentatively blame gpm and move it over
there.

Comment 2 Chris Chabot 2002-07-11 17:30:24 UTC
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-20 03:33:20 UTC
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.