Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 93604 - Heroes 3(games-strategy/heroes3-1.3.1a-r1.ebuild) seg faults in campaign mode
Summary: Heroes 3(games-strategy/heroes3-1.3.1a-r1.ebuild) seg faults in campaign mode
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-22 13:12 UTC by Stewart Martin
Modified: 2006-10-05 15:55 UTC (History)
2 users (show)

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


Attachments
heroes3-1.3.1a-r2.ebuild (heroes3-1.3.1a-r2.ebuild,3.60 KB, text/plain)
2005-05-27 01:45 UTC, Alex Linke
Details
heroes3-wrapper.sh (heroes3-wrapper.sh,199 bytes, text/plain)
2005-05-27 01:46 UTC, Alex Linke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stewart Martin 2005-05-22 13:12:14 UTC
When I run the game as a non-root user, and play a campaign game, the game seg
faults after completing a level.  When playing as root this doesn't happen. 
After completing a level of a campaign, a file is created or altered called
"outpool00.txt" in the games installation directory, and there may be other
"outpoolxx.txt" files, but completing a level takes a long time so I haven't
tested it.  Running as a user without write privileges to the installation
directory, therefore causes the game to seg fault when it cannot create the file.

Reproducible: Always
Steps to Reproduce:
Reproducible: Always
Steps to Reproduce:
1.  Start a campaign game as a user without write privileges to the directory
where the game was installed
2.  Complete a level of the campaign
Comment 1 Alex Linke 2005-05-27 01:41:11 UTC
hi,

<strace>
open("/home/alex/.loki/heroes3/games/CAMP1_1_end.cgm", O_RDWR|O_CREAT|O_TRUNC,
0666) = 18
fstat(18, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb756e000
open("outpool00.txt", O_RDWR|O_CREAT|O_TRUNC, 0666) = -1 EACCES (Permission denied)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
</strace>

heroes3 tries to write a file called 'outpool00.txt' (in general: outputXX.txt')
that contains all information about the heroes that shall be carried over to the
next campaign's level to CWD, which is - through the 'heroes3'-wrapper-script
that got installed to /usr/games/bin/ - determined to be
${GAMES_PREFIX_OPT}/heroes3/, what comes out to be /opt/heroes3/ in my setup. 
This directory is not user-writeable and so the game crashes while trying to
write the file to disk.

Solution:
Modify the wrapper to change CWD to ${HOME}/.loki/heroes3 before executing
/${GAMES_PREFIX_OPT}/heroes3/heroes3.

I updated the ebuild and added a new wrapper-script.

Have fun,
Comment 2 Alex Linke 2005-05-27 01:45:45 UTC
Created attachment 59929 [details]
heroes3-1.3.1a-r2.ebuild
Comment 3 Alex Linke 2005-05-27 01:46:51 UTC
Created attachment 59930 [details]
heroes3-wrapper.sh
Comment 4 Stefan Huszics 2005-06-15 04:25:13 UTC
This bug affects me too and chmod /opt/heroes3 to 770 solves this (which I
assume means the fixed ebuild would work too).

Someone with access, please add this fix to portage. It's not good when users
learn you should run games as root for things to work...

TIA / Stefan
Comment 5 Chris Gianelloni (RETIRED) gentoo-dev 2005-06-15 06:18:37 UTC
No.

We must find a workaround instead, as /opt should be able to be non-writeable.
Comment 6 Stewart Martin 2005-06-15 09:07:56 UTC
What do you mean, "no"? If I'm not mistaken, the new wrapper is a workaround
that leaves /opt/ non-writeable, and therefore this fix should be added to portage.
Comment 7 Alex Linke 2005-06-15 09:40:41 UTC
yes, you are right: 'heroes3-wrapper.sh' takes care of that so you don't need
write-access to /opt/heroes3 in order to play a campaign-game.

the CWD is changed to $HOME/.loki/heroes3/, so every 'outpoolXX.txt'-file can be
dumped there without a trouble or harm.
Comment 8 Stewart Martin 2005-07-15 11:45:39 UTC
Is this ebuild and wrapper ever going to get submitted so this bug report can
get closed?  It would be nice.  No rush.

This fix keeps /opt from having to be made writeable in order for the game to
work, not the opposite.
Comment 9 Chris Gianelloni (RETIRED) gentoo-dev 2005-07-15 12:44:06 UTC
http://www.gentoo.org/proj/en/desktop/games/#doc_chap5_sect10

*sigh*

I've assigned this to myself.  I will get to it when I have time, as I have not even had the chance to look at 
this.
Comment 10 Stewart Martin 2005-08-04 03:28:05 UTC
"When is it appropriate to ask when a bug will be resolved/a new ebuild will be
added?

Never. "

I figured that.  Sorry. My intent was actually to make sure it was clear that
this wrapper was good and that all it needs now is to be added to portage. 
Maybe that was already clear, I just wanted to further clarify.

Comment 11 Chris Gianelloni (RETIRED) gentoo-dev 2006-10-05 15:55:40 UTC
Fixed in CVS... sorry it took so long... I had to find my stupid CD...