Bug 118530

Summary: newt calls Gpm_Close() even if Gpm_Open() failed
Product: [Fedora] Fedora Reporter: Andreas Hasenack <andreas>
Component: newtAssignee: Eido Inoue <havill>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: rawhideCC: havill
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: 0.51.6-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-15 15:19:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 114961, 123268    

Description Andreas Hasenack 2004-03-17 14:37:43 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Gecko/20040315 Firefox/0.8

Description of problem:
Authconfig segfaults when selecting NIS and ypbind is not installed.
It warns the user about the ypbind requirement but, when one selects
"next", it just segfaults.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Remove ypbind
2. start authconfig and select NIS. It warns that the ypbind package
is necessary. Click ok.
3. Go to the next screen. It segfaults.

It actually doesn't matter if one chooses NIS, it could also be
kerberos5, as long as a required package is not installed and the newt
callback function is called.

Actual Results:  authconfig segfaults when exiting the first screen in
an attempt to go to the next one.

Expected Results:  It shouldn't segfault.

Additional info:

Comment 1 Andreas Hasenack 2004-04-26 20:56:03 UTC
Problem persists with authconfig-4.6.2-1

Comment 2 Nalin Dahyabhai 2004-05-07 21:32:25 UTC
Unable to reproduce this with test 2 (20040325) or current Raw Hide. 
If you can still reproduce this with Raw Hide, please add a stack
trace to this report.  Meantime, marking worksforme.

Comment 3 Andreas Hasenack 2004-05-10 14:09:36 UTC
with authconfig-4.6.2-1 and newt-0.51.6:
Program received signal SIGSEGV, Segmentation fault.        
mqqqqqqqqqqj                  mqqqqqqqqqj           x                
0x400afda0 in Gpm_Close () at form.c:326           x                 
326           next=gpm_stack->next;                x                 
(gdb) bt                                          
#0  0x400afda0 in Gpm_Close () at form.c:326                         
#1  0x400b104a in newtFormRun (co=0x808b890, es=0xbfffe7e0) at
#2  0x400b0a5c in newtRunForm (co=0x808b890) at form.c:816           
#3  0x0804cf2d in getMainChoices (back=0, nisAvail=0, ldapAvail=0,
kerberosAvail=0, smbAvail=0, cacheAvail=0, authInfo=0x8083e00) at
#4  0x0804d096 in getChoices (back=0, nisAvail=0, ldapAvail=0,
kerberosAvail=0, smbAvail=0, cacheAvail=0, authInfo=0x8083e00) at
#5  0x0804f9f8 in main (argc=0, argv=0x0) at authconfig.c:1249       
(gdb) frame 0                                                        
#0  0x400afda0 in Gpm_Close () at form.c:326ço> seleciona   |  <F12>
próxima tela                                                         
326           next=gpm_stack->next;
(gdb) p gpm_stack->next
Cannot access memory at address 0x10
(gdb) p gpm_stack
$2 = (Gpm_Stst *) 0x0

Comment 4 Andreas Hasenack 2004-05-10 14:53:16 UTC
I couldn't reproduce this in fedora core 2 test3, however. I'll check
version numbers and patches for the relevant programs and libs.

Comment 5 Andreas Hasenack 2004-05-10 15:51:39 UTC
I added this quick patch and it stopped segfaulting. Not sure yet if
it's the right way, I'm not familiar with this code:
--- newt-0.51.6/form.c~ 2003-01-04 17:15:25.000000000 -0200
+++ newt-0.51.6/form.c  2004-05-10 12:45:06.532824552 -0300
@@ -893,6 +893,7 @@
     struct timeval nextTimeout, now, timeout;
 #ifdef USE_GPM
     int x, y;
+   int success;
     Gpm_Connect conn;
     Gpm_Event event;

@@ -902,7 +903,7 @@
     conn.minMod      = 0;
     conn.maxMod      = 0;

-    Gpm_Open(&conn, 0);
+    success = Gpm_Open(&conn, 0);

@@ -1062,6 +1063,7 @@
 #ifdef USE_GPM
+   if (success > 0)

Comment 6 Nalin Dahyabhai 2004-05-10 21:06:06 UTC
If that affects it, then I'm really confused.  AFAIK newt's gpm code
isn't even compiled in.  Cc'ing Adrian, the current newt maintainer.

Comment 7 Andreas Hasenack 2004-05-10 21:10:18 UTC
Uhh, I guess I was not clear enough. My newt build explicitly enables
gpm support. Anyway, changing component to newt, nothing to do with
authconfig indeed.

Comment 8 Eido Inoue 2004-05-11 01:47:47 UTC
the most recent build of gpm changes the way Gpm_Open() returns. Have
you tested the pkg in the latest rawhide?

Comment 9 Eido Inoue 2004-05-11 01:52:36 UTC
rechanging the component-- obviously newt needs to check the return
value of Gpm_Open() so it doesn't try to close a non-existant handle