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

Bug 116629

Summary: games-arcade/tomatoes-1.55 is unable to open config file on amd64
Product: Gentoo Linux Reporter: Tony Vroon (RETIRED) <chainsaw>
Component: [OLD] GamesAssignee: Gentoo Games <games>
Status: RESOLVED FIXED    
Severity: normal CC: amd64, voyageur
Priority: High    
Version: 2005.1   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to fix c_str use

Description Tony Vroon (RETIRED) gentoo-dev 2005-12-24 10:54:06 UTC
chainsaw@amalthea ~ $ tomatoes
Error appeared:
 - Unable to load config file: \uffff

In the get_config_location (config.cpp), first the containing directory ~/.tomatoes and afterwards the file tomatoes.cfg is opened for reading. Strace output shows that this succeeds:
open("/home/chainsaw/.tomatoes/", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
close(3)                                = 0
open("/home/chainsaw/.tomatoes/config.cfg", O_RDONLY) = 3
close(3)                                = 0

However, things go wrong after that:
open("\uffff\uffffT", O_RDONLY)                   = -1 ENOENT (No such file or directory)

This is the first relevant line in init.cpp:
load_config(get_config_location(), &config);

It would appear that although get_config_location does what it should, the actual return value gets corrupted.
Comment 1 Bernard Cafarelli gentoo-dev 2006-02-12 15:14:10 UTC
Ah C++ and its wonders... The c_str function translates a C++ string into a C char*, but this pointer will only be available for the next instruction! So using it to return the correct path will not work... I fixed up a patch to it (thanks strcpy), so I could burst some tomatoes happily ;)
Comment 2 Bernard Cafarelli gentoo-dev 2006-02-12 15:15:53 UTC
Created attachment 79615 [details, diff]
Patch to fix c_str use
Comment 3 Tony Vroon (RETIRED) gentoo-dev 2006-02-14 15:13:59 UTC
The package has been revision bumped to make sure that your fix reaches all ~amd64  users. Thanks for your work on this Bernard :)
Comment 4 Bernard Cafarelli gentoo-dev 2006-02-14 23:42:54 UTC
You're welcome, smashing tomatoes is good for people, even ~amd64 ones ;)