Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 19238 - GPM fails when running MC as a normal user + fix
Summary: GPM fails when running MC as a normal user + fix
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Michael M Nazaroff (RETIRED)
URL:
Whiteboard:
Keywords:
: 18030 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-13 08:54 UTC by Oldrich Jedlicka
Modified: 2003-06-15 10:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oldrich Jedlicka 2003-04-13 08:54:15 UTC
This bug appears when you run MC as a normal user (tested on app-misc/mc-4.6.0 
and sys-libs/gpm-1.20.0-r5, but probably in earlier versions of gpm). You will 
get on stderr this message

Failed info: [/var/tmp/portage/gpm-1.20.0-r5/work/gpm-1.20.0/src/liblow.c(446)]:
Warning: closing connection

and syslog contains

Apr 13 13:24:50 oldium /usr/sbin/gpm[735]: info: [/var/tmp/portage/gpm-1.20.
0-r5/work/gpm-1.20.0/src/gpm.c(786)]: 
Apr 13 13:24:50 oldium /usr/sbin/gpm[735]: Connecting at fd 10
Apr 13 13:24:50 oldium /usr/sbin/gpm[735]: warning: [/var/tmp/portage/gpm-1.20.
0-r5/work/gpm-1.20.0/src/gpm.c(857)]: 
Apr 13 13:24:50 oldium /usr/sbin/gpm[735]: Failed gpm connect attempt by uid 
1000 for vc /dev/vc/0

Problem is in /dev/vc/0, which is incorrectly recognized in liblow.c. I found a 
solution at http://archive.linuxfromscratch.
org/mail-archives/lfs-support/2002/08/0482.html (corrects line 265 of liblow.c), 
but I think there is one more hidden bug (line 246 of liblow.c) - problem is 
with string allocation and working with strlen(). Here is my patch (one more 
line corrected compared to a patch at a www page above):

--- liblow.c.old	2003-04-13 14:25:52.000000000 +0200
+++ liblow.c	2003-04-13 14:28:32.000000000 +0200
@@ -243,7 +243,7 @@
       conn->vc=0;                 /* default handler */
       if (flag > 0) {  /* forced vc number */
          conn->vc=flag;
-         if((tty = malloc(strlen(consolename)+Gpm_cnt_digits(flag))) != NULL)
+         if((tty = malloc(strlen(consolename)+Gpm_cnt_digits(flag)+1)) != NULL)
             gpm_report(GPM_PR_OOPS,GPM_MESS_NO_MEM);
          snprintf(tty,strlen(consolename)-1,"%s",consolename);
          sprintf(&tty[strlen(consolename)-1],"%i",flag);
@@ -262,7 +262,7 @@
             goto err;
          }   
           
-         conn->vc=atoi(&tty[strlen(consolename)]);
+         conn->vc=atoi(&tty[strlen(consolename)-1]);
       }
 
       if (gpm_consolefd == -1)
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2003-04-13 09:01:34 UTC
this is a MUCH needed fix
Comment 2 Oldrich Jedlicka 2003-04-13 13:26:57 UTC
I think on line 246 in liblow.c it is not needed to add 1 - if consolename contains one number (e.g. "/dev/vc/0") at the end of string.
Comment 3 Oldrich Jedlicka 2003-04-28 05:07:29 UTC
Will there be version 1.20.1 of GPM? This problem is fixed there. This newest version is about 5 months old (ftp://arcana.linux.it/pub/gpm/) and I didn't find it in Gentoo.
Comment 4 Aron Griffis (RETIRED) gentoo-dev 2003-05-26 16:37:55 UTC
I don't use gpm.  The suggested upgrade to gpm-1.20.1 is stymied by local patches that no longer apply.  Please give this to somebody more familiar with gpm & mc.
Comment 5 Brad Cowan (RETIRED) gentoo-dev 2003-06-02 11:37:48 UTC
*** Bug 18030 has been marked as a duplicate of this bug. ***
Comment 6 Michael M Nazaroff (RETIRED) gentoo-dev 2003-06-03 04:53:47 UTC
ebuild for the new gpm is one it's way.  I have it written just need to test and verify it works well since it's a moderate overhall of the whole ebuild.

naz
Comment 7 Michael M Nazaroff (RETIRED) gentoo-dev 2003-06-04 01:56:21 UTC
Ebuild is commited and masked, please test :-)

gpm-1.20.1.ebuild

naz
Comment 8 Michael M Nazaroff (RETIRED) gentoo-dev 2003-06-15 10:20:08 UTC
The new gpm ebuild is in portage but is marked unstable, I will soon be marking it stable so we can dump so of these problems people are having.