Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 116629 - games-arcade/tomatoes-1.55 is unable to open config file on amd64
Summary: games-arcade/tomatoes-1.55 is unable to open config file on amd64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-24 10:54 UTC by Tony Vroon (RETIRED)
Modified: 2006-02-14 23:42 UTC (History)
2 users (show)

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


Attachments
Patch to fix c_str use (tomatoes-1.55-c_str.patch,524 bytes, patch)
2006-02-12 15:15 UTC, Bernard Cafarelli
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 ;)