Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 168433

Summary: sturmbahnfahrer: wrong path to share directory
Product: Gentoo Linux Reporter: mephinet <mephinet>
Component: [OLD] GamesAssignee: Gentoo Games <games>
Status: VERIFIED FIXED    
Severity: normal    
Priority: High    
Version: 2006.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: strace output
output of "emerge -evp games-sports/sturmbahnfahrer"

Description mephinet 2007-02-26 09:57:03 UTC
Hi gamers,

when emerging sturmbahnfahrer-1.3, the game's data files get stored in 
/usr/share/games/sturmbahnfahrer

if I start the program, I get:

Cannot load '/usr/games/share/games/sturmbahnfahrer/sounds/rpm_graph.txt'
sturmbahnfahrer: intro.cxx:89: Intro::Intro(SoundEngineAlsa*, const std::string&): Assertion `f' failed.
Aborted

notice the extra "games" in the path.

# emerge --info
Portage 2.1.2-r9 (default-linux/x86/2006.1/desktop, gcc-3.4.6, glibc-2.5-r0, 2.6.19-gentoo-r5 i686)
=================================================================
System uname: 2.6.19-gentoo-r5 i686 AMD Athlon(TM) XP 2200+
Gentoo Base System release 1.12.9
Timestamp of tree: Mon, 26 Feb 2007 02:20:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
dev-java/java-config: 1.3.7, 2.0.31
dev-lang/python:     2.3.5-r3, 2.4.3-r4, 2.5-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r6
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=athlon-xp -fomit-frame-pointer -pipe -funroll-loops"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O3 -march=athlon-xp -fomit-frame-pointer -pipe -funroll-loops"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks fixpackages metadata-transfer parallel-fetch sandbox sfperms strict userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.inode.at/ http://gd.tuwien.ac.at/opsys/linux/gentoo/"
LINGUAS="en de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X aac aalib acpi aiglx alsa ao apache2 artworkextra asf bash-completion berkdb bitmap-fonts branding bzip2 bzlib c++ cairo cdda cdparanoia chroot cli cpdflib cpudetection cracklib crypt cups curl dbus dio directfb distribution divx divx4linux djvu dmx dri dvi effects emacs emboss encode enscript ethereal exif expat fam fbcon ffmpeg firefox flac fltk font-server ftp gcj gd gdbm gif gimpprint glibc-omitfp glitz glut gmedia gmp gnome gnutls gphoto2 gpm graphviz gs gtk gtk2 hal howl httpd icecast iconv icq imagemagick imap imlib inkjar innodb ipod isdnlog java javascript joystick jpeg latex ldap libedit libg++ libnotify libsexy logrotate lzo mad maildir matrox mbox mhash mime mmx mmxext mng motif mozbranding mozcalendar mozdevelop mozilla mozsvg mp3 mpeg multiuser musepack mysql ncurses network new-login nfs nis no-old-linux noplugin nptl nptlonly objc objc-gc ocaml offensive ogg openal opengl pam pch pcmcia pcre pdf perl pic plugin png posix postgres ppds pppd python qt3 qt4 quicktime readline real realmedia reflection rle rss rtc ruby samba sasl sdl sdl-image session shared sharedmem shout slang sockets speex spell spl sse ssl stream svg symlink sysfs t1lib tcl tcltk tcpd tetex theora tiff tk truetype truetype-fonts type1-fonts usb utempter vim-with-x vorbis vorbis-psy win32codecs wma wmp x86 xanim xforms xine xinerama xinetd xml xml2 xorg xosd xprint xscreensaver xv xvid zeroconf zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse joystick evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" USERLAND="GNU" VIDEO_CARDS="matrox mga"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Mr. Bones. (RETIRED) gentoo-dev 2007-02-26 18:08:24 UTC
run strace -o out /usr/games/bin/sturmbahnfahrer and attach the out file as text/plain please.
Comment 2 mephinet 2007-02-27 12:40:50 UTC
Created attachment 111406 [details]
strace output

strace output attached.
doesn't contain anything useful, imho, though.

open("/usr/games/share/games/sturmbahnfahrer/sounds/rpm_graph.txt", O_RDONLY) = -1 ENOENT (No such file or directory)
Comment 3 mephinet 2007-02-27 14:28:00 UTC
When I debug into the main function, what happens is this:

(gdb) p (char *) argv [0]
$15 = 0xbfb6a74a "/usr/games/bin/sturmbahnfahrer"

but after the line
 char *bindirname  = dirname(argv[0]);
 
(gdb) p (char *) argv [0]
$16 = 0xbfb6a74a "/usr/games/bin"

which means that argv has been modified, which is according to the man page of dirname:

> Both  dirname() and basename() may modify the contents of path, 
> so copies should be passed to these functions. 

then, in the else clause of if (!strcmp(bindirname,".")),
dirname is called again,

dirprefix = dirname(bindirname) + ...

so bindirname is modified too, and the dirprefix is set to "/usr/games". then, "share/games/..." is appended to it, resulting in

(gdb) p dirprefix->_M_dataplus->_M_p
$21 = 0x83e30f4 "/usr/games/share/games/sturmbahnfahrer"

which is wrong...
Comment 4 Mr. Bones. (RETIRED) gentoo-dev 2007-02-28 17:36:26 UTC
How about the output from "emerge -evp games-sports/sturmbahnfahrer"

See, it works fine here with all stable x86 packages so I'm trying to figure out what's different about your stuff.
Comment 5 mephinet 2007-02-28 18:12:59 UTC
Created attachment 111598 [details]
output of "emerge -evp games-sports/sturmbahnfahrer"

output attached.
Reading the code, things would work if sys.argv [0] is a file in a 2nd level directory. So, if you create e.g a symlink in /usr/bin, then the code would strip
/usr/bin/sturmbahnfahrer down to /usr, and the generated string would be OK. But for a 3rd level directory like /usr/games/bin, the code won't work, imho.

what does "which sturmbahnfahrer" return on your box?
Comment 6 Mr. Bones. (RETIRED) gentoo-dev 2007-02-28 22:26:52 UTC
$ which sturmbahnfahrer 
/usr/games/bin/sturmbahnfahrer

It's something on your system.  The stock stuff in portage should work fine.

Maybe try remerging ode and plib.
Comment 7 Mr. Bones. (RETIRED) gentoo-dev 2007-02-28 22:29:00 UTC
Ah... so, don't specify the exact path.  Try just running it as "sturmbahnfahrer".  I bet that works.
Comment 8 Mr. Bones. (RETIRED) gentoo-dev 2007-02-28 22:42:03 UTC
Ok... yeah, the whacking with argv is silly.  I "fixed" it with a sed hammer.  sleep 30m ; emerge --sync ; emerge -v sturmbahnfahrer to get the fix.
Comment 9 mephinet 2007-03-01 10:07:55 UTC
works fine, thanks.