Bug 120240

Summary: w3m segfaults when calling getch()
Product: [Fedora] Fedora Reporter: Akira TAGOH <tagoh>
Component: w3mAssignee: Akira TAGOH <tagoh>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dickey, dpoon
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 0.5-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-04-21 06:11:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 114963    

Description Akira TAGOH 2004-04-07 02:41:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.4.1)
Gecko/20031114

Description of problem:
it seems that the applications which linked against gpm doesn't work
at the same time, when it's ran, that application crashes.

Here is the backtrace:
$ gdb --args w3m -o http://www.google.co.jp/
GNU gdb Red Hat Linux (6.0post-0.20040223.8rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
                                                                     
                                                       
(gdb) r
Starting program: /usr/bin/w3m http://www.google.co.jp/
Detaching after fork from child process 2035.
Detaching after fork from child process 2037.
Program received signal SIGSEGV, Segmentation fault.
0x07e50af0 in Gpm_Wgetch (win=0x0) at lib/libcurses.c:80
80              return GET(win);
(gdb) bt
#0  0x07e50af0 in Gpm_Wgetch (win=0x0) at lib/libcurses.c:80
#1  0x08091aec in do_getch () at terms.c:1852
#2  0x0804c927 in main (argc=4, argv=0xfef02194, envp=0xfef021a8) at
main.c:1094
#3  0x0099ef43 in __libc_start_main () from /lib/tls/libc.so.6
#4  0x0804b691 in _start ()
(gdb)


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

How reproducible:
Always

Steps to Reproduce:
1.run gnome-terminal and screen then
2.run w3m http://www.google.co.jp/
3.press any key
    

Actual Results:  w3m crashes.

Expected Results:  w3m works well.

Additional info:

Comment 1 Derek Poon 2004-04-19 12:10:59 UTC
The cause of the segfault is that w3m is not linked with libncurses,
which defines the wgetch() function.  The linker does not complain
when building or running w3m because gpm has declared wgetch to be a
weak symbol -- see gpm-1.20.1-weak-wgetch.patch in the gpm SRPM.

The solution is to append -lncurses at the end of the W3M_LIBS macro
in w3m's Makefile.  That should be accomplished by patching the
configure script.  A less robust kludge would be to simply change
w3m.spec to use a --with-termlib=ncurses argument when calling configure.

(Bug component should probably be changed from gpm to w3m, and a more
accurate summary would be "w3m segfaults when calling getch()".)

Comment 2 Akira TAGOH 2004-04-20 02:49:53 UTC
ok, I have read the changelog for -weak-wgetch.patch. this will be
fixed in w3m. reassign it then.

Comment 3 Akira TAGOH 2004-04-21 06:11:56 UTC
Fixed in 0.5-3

Comment 4 Thomas E. Dickey 2004-10-03 14:10:20 UTC
The analysis is incorrect.  See
http://invisible-island.net/ncurses/ncurses.faq.html#using_gpm_lib