Bug 194611 - [patch] japanese/nethack34: Fix segfault on FreeBSD/amd64
Summary: [patch] japanese/nethack34: Fix segfault on FreeBSD/amd64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: John Marino
Depends on:
Reported: 2014-10-26 14:04 UTC by WATANABE Kazuhiro
Modified: 2014-11-09 16:50 UTC (History)
1 user (show)

See Also:

A patch for japanese/nethack34. (6.96 KB, patch)
2014-10-26 14:04 UTC, WATANABE Kazuhiro
no flags Details | Diff
poudriere testport log with the patch (9.1-RELEASE amd64) (48.66 KB, text/x-log)
2014-10-26 14:06 UTC, WATANABE Kazuhiro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description WATANABE Kazuhiro 2014-10-26 14:04:00 UTC
Created attachment 148666 [details]
A patch for japanese/nethack34.

(1) Fix segfault on FreeBSD/amd64
(2) Uncomment "define USE_XPM" for a default configuration
(3) Install an X resource file for appropriate Japanese font support on X
(4) Remove @dirrm, and use @dir() instead of @dirrmtry/"chmod"/"chown"

(1) Fix segfault on FreeBSD/amd64 (New: patch-include__xwindow.h)

This is not occured without (2).

When a player dies in X mode, jnethack popups an window which shows
the player's final status and a tombstone image (rip.xbm).

But on FreeBSD/amd64, fails to display the image and causes a segmentation fault.

| root@aquarius-vm:/home/nabe # gdb /usr/local/share/jnethack/jnethack `pgrep jnethack`
| GNU gdb 6.1.1 [FreeBSD]
| 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 "amd64-marcel-freebsd"...
| Attaching to program: /usr/local/share/jnethack/jnethack, process 3947
| Reading symbols from /lib/libncurses.so.8...done.
| Loaded symbols for /lib/libncurses.so.8
| Reading symbols from /libexec/ld-elf.so.1...done.
| Loaded symbols for /libexec/ld-elf.so.1
| 0x0000000801f8925c in poll () from /lib/libc.so.7
| (gdb) cont
| Continuing.
| Program received signal SIGSEGV, Segmentation fault.
| 0x00000008017f52c0 in XmbTextEscapement () from /usr/local/lib/libX11.so.6
| (gdb) where
| #0  0x00000008017f52c0 in XmbTextEscapement () from /usr/local/lib/libX11.so.6
| #1  0x00000000005bb18c in rip_exposed (w=0x803101200, client_data=0x0, widget_data=0x7fffffffc410) at ../win/X11/wintext.c:681
| #2  0x000000080154b048 in XtCallCallbacks () from /usr/local/lib/libXt.so.6
| #3  0x00000000005a9556 in Redisplay (w=0x803101200, event=0x7fffffffc410, region=0x8030a91a0) at ../win/X11/Window.c:127
| #4  0x00000008015583f5 in SendExposureEvent () from /usr/local/lib/libXt.so.6
| #5  0x0000000801558952 in XtDispatchEventToWidget () from /usr/local/lib/libXt.so.6
| #6  0x0000000801558e4c in _XtDefaultDispatcher () from /usr/local/lib/libXt.so.6
| #7  0x00000008015580b8 in XtDispatchEvent () from /usr/local/lib/libXt.so.6
| #8  0x00000000005b1622 in x_event (exit_condition=2) at ../win/X11/winmap.c:1842
| #9  0x00000000005ba2ed in display_text_window (wp=0x86dfe0, blocking=1 '\001') at ../win/X11/wintext.c:270
| #10 0x00000000005ab708 in X11_display_nhwindow (window=4, blocking=1 '\001') at ../win/X11/winX.c:801
| #11 0x000000000046b9f3 in done (how=0) at end.c:1151
| #12 0x0000000000469acb in done_in_by (mtmp=0x803310a40) at end.c:317
| #13 0x00000000004ade78 in mdamageu (mtmp=0x803310a40, n=4) at mhitu.c:2740
| #14 0x00000000004ab2d2 in hitmu (mtmp=0x803310a40, mattk=0x829f00) at mhitu.c:2134
| #15 0x00000000004a71fe in mattacku (mtmp=0x803310a40) at mhitu.c:807
| #16 0x00000000004d0159 in dochug (mtmp=0x803310a40) at monmove.c:614
| #17 0x00000000004cdde6 in dochugw (mtmp=0x803310a40) at monmove.c:110
| #18 0x00000000004c2de4 in movemon () at mon.c:692
| #19 0x0000000000404cba in moveloop () at allmain.c:94
| #20 0x000000000059f36d in main (argc=2, argv=0x7fffffffd158) at ../sys/unix/unixmain.c:321
| (gdb)

This is a jnethack's specific problem, and not occured on FreeBSD/i386.
To solve the problem, add a missing function prototype to include/xwindow.h.

(2) Uncomment "define USE_XPM" for a default configuration
    (Update: patch-include-config.h)

It enables the tombstone image and tileset support.

(3) Install an X resource file for appropriate Japanese font support on X
    (Update: Makefile, New: patch-win__X11__JNetHack.ad)

(4) Remove @dirrm, and use @dir() instead of @dirrmtry/"chmod"/"chown"
    (Update: pkg-plist patch-sys-unix-Makefile.top)

The latter one replaces my previous "quick fix", and is taken from
games/nethack34.  Thanks!
Comment 1 WATANABE Kazuhiro 2014-10-26 14:06:00 UTC
Created attachment 148667 [details]
poudriere testport log with the patch (9.1-RELEASE amd64)
Comment 2 John Marino freebsd_committer 2014-11-01 12:36:15 UTC
This port is unmaintainer, but the OP provided the last update too.  Promoting this tested port to patch-ready.
Comment 3 commit-hook freebsd_committer 2014-11-09 16:32:12 UTC
A commit references this bug:

Author: marino
Date: Sun Nov  9 16:31:21 UTC 2014
New revision: 372365
URL: https://svnweb.freebsd.org/changeset/ports/372365

  japanese/nethack34: Fix segfault on amd64 among other things

  PR:		194611
  Submitted by:	WATANABE Kazuhiro

Comment 4 John Marino freebsd_committer 2014-11-09 16:50:49 UTC