Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46665 - bzflag 1.10.4: bzfs SEGV at startup
Summary: bzflag 1.10.4: bzfs SEGV at startup
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-03 00:00 UTC by hosed
Modified: 2004-05-17 04:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hosed 2004-04-03 00:00:28 UTC
This seems like a bzflag problem, not a gentoo problem, but I don't know.

"emerge bzflag" gives me bzflag 1.10.4.  That includes bzfs, the game server,
which can be started by the bzflag (the client) or by itself on the command
line.  In either case, on my box, and on a friend's gentoo box, bzfs SEGV's at
startup.

I couldn't figure out how to build a debug version through emerge (is there a
way?  "env USE=debug CFLAGS=-g CXXFLAGS=-g emerge bzflag" still built it
non-debug), so I downloaded the 1.10.4 source from www.bzflag.org and built it
myself.  bzfs still croaked with this stack trace:

  (gdb) where
  #0  0x4009ed28 in std::string::operator=(char const*) ()
     from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/libstdc++.so.5
  #1  0x080859c2 in main (argc=1, argv=0xbffff484) at bzfs.cxx:4603

bzfs.cxx:4603 looks like this:

    clOptions->publicizedAddress = Address::getHostName();

The problem seems to be that Address::getHostName() is returning NULL.  If you
replace that line with something goofy like this, bzfs works:

    const char *tc = Address::getHostName();
    if (!tc) tc = "bogus";
    clOptions->publicizedAddress = tc;

I'm surprised that std::string::operator=(char const*) doesn't like being given
NULL, but whatever.  (Is that normal?  The author of bzflag's
Address::getHostName() doesn't seem to think so...)  Here's what
Address::getHostName() is doing (the hostname argument is NULL in this case):

  const char*		Address::getHostName(const char* hostname)
  {
    char myname[MAXHOSTNAMELEN+1];
    const char* name = hostname;
    if (!name)
      if (gethostname(myname, sizeof(myname)) >= 0)
        name = myname;
    if (!name) return NULL;
    struct hostent* hent = gethostbyname(name);
    if (!hent) return NULL;
    return hent->h_name;
  }

So gethostname() and/or gethostbyname() is returning NULL on my box.  (Again, I
don't know whether that's normal.)  My box is on DSL, not a "real" network, and
I've only had it for a couple of days, so it's likely that my network
configuration is weird/broken.  Let me know what additional information would
be helpful there.


Reproducible: Always
Steps to Reproduce:
1. emerge bzflag
2. /usr/games/bin/bzfs


Actual Results:  
bzfs immediately SEGV's 

Expected Results:  
listened on a port for client connections 

Portage 2.0.50-r1 (default-x86-2004.0, gcc-3.3.2, glibc-2.3.2-r9, 
2.4.22-gentoo-r7) 
================================================================= 
System uname: 2.4.22-gentoo-r7 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz 
Gentoo Base System version 1.4.3.13 
Autoconf: sys-devel/autoconf-2.58 
Automake: sys-devel/automake-1.7.7 
ACCEPT_KEYWORDS="x86" 
AUTOCLEAN="yes" 
CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer" 
CHOST="i686-pc-linux-gnu" 
COMPILER="gcc3" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb:/usr/kde/3.2/share/config:/usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" 
CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs ccache sandbox" 
GENTOO_MIRRORS="http://mirrors.tds.net/gentoo ftp://mirrors.tds.net/gentoo 
http://mirror.tucdemonic.org/gentoo/ http://gentoo.seren.com/gentoo" 
MAKEOPTS="-j3" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="" 
SYNC="rsync://rsync.gentoo.org/gentoo-portage" 
USE="X alsa apache2 apm arts avi berkdb cdr crypt cups dvd encode fam flac 
flash foomaticdb gd gdbm gif gnome gpm gtk gtk2 imagemagick imlib java 
joystick jpeg kde libg++ libwww mad mikmod mmx motif mpeg ncurses nls 
oggvorbis opengl oss pam pda pdflib perl png python qt quicktime readline 
scanner sdl slang speex spell sse ssl svga tcltk tcpd tiff truetype unicode 
usb videos wmf x86 xml2 xmms xv zlib" 
 
I don't know how similar that is to my friend's gentoo box which had the same 
problem.
Comment 1 Sean Morrison 2004-05-16 16:05:53 UTC
This bug has been fixed in the latest bzflag cvs and will be available in bzflag 1.12.0.  The recent release of 1.10.6 will unfortunately not include the fix (didn't know about this bug report until post-release) but subsequent releases will.

Cheers!
brlcad and the bzflag developers
Comment 2 Chris Gianelloni (RETIRED) gentoo-dev 2004-05-17 04:17:47 UTC
Well, I guess that takes care of that.

Thanks, Sean.

Is there any way we could get a patch for 1.10.6 for us to include in the interim?