Red Hat Bugzilla – Bug 120240
w3m segfaults when calling getch()
Last modified: 2007-11-30 17:10:39 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.4.1)
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
welcome to change it and/or distribute copies of it under certain
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
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);
#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
#3 0x0099ef43 in __libc_start_main () from /lib/tls/libc.so.6
#4 0x0804b691 in _start ()
Version-Release number of selected component (if applicable):
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.
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()".)
ok, I have read the changelog for -weak-wgetch.patch. this will be
fixed in w3m. reassign it then.
Fixed in 0.5-3
The analysis is incorrect. See