Bug#345305: netris: segfault on amd64 in curses.c:RefreshWindow (patch)
Package: netris Version: 0.52-3 Severity: important Netris segfaults immediately when invoked as 'netris'. Segfaults once a connection is made for -c and -w. Debugging shows the problem is in curses.c:RefreshWindow. This happens on amd64, but not i386. There's a patch below - I've got only a vague notion as to why it works. Basic testing done on the vanilla source, -3 and -5 packages on amd64 and the -3 on i386. Brian --- curses.c.orig 2005-12-30 10:17:21.0 + +++ curses.c2005-12-30 10:23:47.0 + @@ -20,6 +20,7 @@ */ #include netris.h +#include time.h #include sys/types.h #include unistd.h #include curses.h @@ -341,9 +342,10 @@ { static char timeStr[2][32]; time_t theTime; + struct tm tmp; time(theTime); - strftime(timeStr[0], 30, %I:%M %p, localtime(theTime)); + strftime(timeStr[0], 30, %I:%M %p, localtime_r(theTime,tmp)); /* Just in case the local curses library sucks */ if (strcmp(timeStr[0], timeStr[1])) { -- System Information: Debian Release: 3.1 Architecture: amd64 (x86_64) Kernel: Linux 2.6.14.3 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) Versions of packages netris depends on: ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an ii libncurses5 5.4-4Shared libraries for terminal hand -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#345305: netris: segfault on amd64 in curses.c:RefreshWindow (patch)
* Brian Brazil [EMAIL PROTECTED] [2005-12-30 10:58]: Netris segfaults immediately when invoked as 'netris'. Segfaults once a connection is made for -c and -w. Debugging shows the problem is in curses.c:RefreshWindow. This happens on amd64, but not i386. Can you maybe get me some debug output? The build process of netris supports DEB_BUILD_OPTIONS='noopt nostrip' so you should be able to build it for debugging. There's a patch below - I've got only a vague notion as to why it works. Basic testing done on the vanilla source, -3 and -5 packages on amd64 and the -3 on i386. Strange. I wonder why the thread-safe version might be needed... Or might it even be related to only the missing #include? According to the manpage of localtime(3) it would be needed anyway... Do you might want to try it with only the added include but no changed call, and DEB_BUILD_OPTIONS set appropriately? It might take me a while to be able to approach it on an amd64 machine myself. So long, Alfie -- Achtung: Wenn Sie ein Skeptiker und für neue innovative Möglichkeiten nicht aufgeschlossen sind, dann sollten Sie diese Webseite verlassen! -- empfangene SPAM-Mail signature.asc Description: Digital signature
Bug#345305: netris: segfault on amd64 in curses.c:RefreshWindow (patch)
On Fri, Dec 30, 2005 at 12:32:54PM +0100, Gerfried Fuchs wrote: * Brian Brazil [EMAIL PROTECTED] [2005-12-30 10:58]: Netris segfaults immediately when invoked as 'netris'. Segfaults once a connection is made for -c and -w. Debugging shows the problem is in curses.c:RefreshWindow. This happens on amd64, but not i386. Can you maybe get me some debug output? The build process of netris supports DEB_BUILD_OPTIONS='noopt nostrip' so you should be able to build it for debugging. With -3: [EMAIL PROTECTED]:~/tmp/netris-0.52$ gdb ./netris (gdb) r Starting program: /home/bbrazil/tmp/netris-0.52/netris Program received signal SIGSEGV, Segmentation fault. 0x2aecefd7 in strftime () from /lib/libc.so.6 (gdb) bt full #0 0x2aecefd7 in strftime () from /lib/libc.so.6 No symbol table info available. #1 0x004040de in RefreshScreen () at curses.c:346 timeStr = {'\0' repeats 31 times, '\0' repeats 31 times} theTime = 1135942664 #2 0x00402612 in OneGame (scr=0, scr2=-1) at game.c:150 event = {type = 5292896, u = {key = 0 '\0', net = {type = 2864443392, size = 10922, data = 0x7fa5e640}, robot = {size = -1430523904, data = 0x7fa5e640 Pæ¥ÿÿ\177}}} linesCleared = 10922 changed = 1 spied = 0 spying = 0 dropMode = 0 oldPaused = 0 paused = 0 pausedByMe = 0 pausedByThem = 0 pauseTimeLeft = 140737482450496 pieceCount = 0 key = -1430523904 p = 0x0 cmd = 0x70001 Address 0x70001 out of bounds #3 0x004034e4 in main (argc=1, argv=0x7fa5e808) at game.c:546 initConn = 0 waitConn = 0 ch = -1 done = 0 hostStr = 0x0 portStr = 0x0 event = {type = E_none, u = {key = 18 '\022', net = {type = 2863356178, size = 10922, data = 0x2abc0b48}, robot = {size = -143168, data = 0x2abc0b48 }}} (gdb) There's a patch below - I've got only a vague notion as to why it works. Basic testing done on the vanilla source, -3 and -5 packages on amd64 and the -3 on i386. Strange. I wonder why the thread-safe version might be needed... Or might it even be related to only the missing #include? According to the manpage of localtime(3) it would be needed anyway... Do you might want to try it with only the added include but no changed call, and DEB_BUILD_OPTIONS set appropriately? I added the #include for the 'struct tm'. Adding just a #include time.h to curses.c fixes the problem. Brian -- Website: http://www.netsoc.tcd.ie/~bbrazil signature.asc Description: Digital signature
Bug#345305: netris: segfault on amd64 in curses.c:RefreshWindow (patch)
* Brian Brazil [EMAIL PROTECTED] [2005-12-30 11:53]: On Fri, Dec 30, 2005 at 12:32:54PM +0100, Gerfried Fuchs wrote: Do you might want to try it with only the added include but no changed call, and DEB_BUILD_OPTIONS set appropriately? I added the #include for the 'struct tm'. Adding just a #include time.h to curses.c fixes the problem. So no need to switch to localtime_r? Just what I thought. Will add the include in the next upload, and thanks for your help. So long, Alfie -- -!- mode/#debian.de [-o wease|] by wease| * wease| traut BX nicht -- #debian.de signature.asc Description: Digital signature