Symptoms: When a module is selected, save games go to the "mods/$MODULE/scpt" directory, and not the "mods/$MODULE/save" directory as they should. This happens on ToME 2.3.3 with GNU/Linux on i386 (gcc-4.1.1) compiled with an unmodified makefile.std and without any "overrides" in the environment or the make invocation.
-- AnonymousHero 2006-07-30 16:52:36
NeilStevens: Which module? All modules? This sounds like a typo in the module itself to me.
AnonymousHero: Sorry, I should have been more clear. I've tested with both FuryMod and Theme. The strange thing is... when I try to run with the 'standard' Gentoo Linux ebuild/package which compiles with the command (NB: the ebuild patches the scores file path, but nothing else)
gcc -Wall -O1 -pipe -g
-I/usr/X11R6/include -Ilua -I. -DUSE_GCU -DUSE_X11
-DUSE_EGO_GRAPHICS -DUSE_TRANSPARENCY -DSUPPORT_GAMMA
-DUSE_PRECISE_CMOVIE -DUSE_UNIXSOCK -DUSE_LUA
-DIRC_SERVER=\"irc.worldirc.org\" -DIRC_PORT=\"6667\"
-DIRC_CHANNEL=\"#tome\" -DDEFAULT_PATH=\"./lib/\" -c -o [...]
the path to the savegames is somehow corrupted. When I start a character and just press enter when asked for a file name, tome then says that "X/PLAYER" does not exist (where X is an unprintable character represented by a box with dashed borders in the UI). If I enter, say "TEST", then tome says "X/TEST" does not exist. (etc.)
'NeilStevens: Build it with makefile.std instead of that third party setup and see if you still have a problem.
AnonymousHero: That's exactly what I did in the first build which puts (any) module savefiles into '$MODULEPATH/lib/scpt/'. That was with a completely unpatched tome-233 tarball. The second build which resulted in corrupted savefile paths was with the Gentoo ebuild. The only difference between the two seems to be the installation location.
AnonymousHero: I've found the bug. It seems someone got a bit confused about pointer semantics and pass-by-value/reference when refactoring some code in modules.c. Here's a patch which fixes this for 2.3.3. The patch also works for 2.3.4 (with fuzz).
diff -burN tome-233-src/src/modules.c tome-233-src.FIXED/src/modules.c
--- tome-233-src/src/modules.c 2005-12-15 00:13:06.000000000 +0100
+++ tome-233-src.FIXED/src/modules.c 2006-11-23 21:05:00.000000000 +0100
@@ -12,20 +12,19 @@
#include "angband.h"
-static void module_reset_dir_aux(cptr dir, cptr new_path)
+static void module_reset_dir_aux(cptr *dir, cptr new_path)
{
char buf[1025];
- cptr *d = &dir;
/* Build the new path */
- strnfmt(buf, 1024, "%s%s%s", dir, PATH_SEP, new_path);
+ strnfmt(buf, 1024, "%s%s%s", *dir, PATH_SEP, new_path);
- string_free(*d);
- *d = string_make(buf);
+ string_free(*dir);
+ *dir = string_make(buf);
/* Make it if needed */
- if (!private_check_user_directory(*d))
- quit(format("Unable to create module dir %s\n", *d));
+ if (!private_check_user_directory(*dir))
+ quit(format("Unable to create module dir %s\n", *dir));
}
void module_reset_dir(cptr dir, cptr new_path)
@@ -71,12 +70,12 @@
#ifdef PRIVATE_USER_PATH_DATA
else if (!strcmp(dir, "data"))
{
- module_reset_dir_aux(ANGBAND_DIR_DATA, new_path);
+ module_reset_dir_aux(&ANGBAND_DIR_DATA, new_path);
}
#endif
else if (!strcmp(dir, "save"))
{
- module_reset_dir_aux(ANGBAND_DIR_SAVE, new_path);
+ module_reset_dir_aux(&ANGBAND_DIR_SAVE, new_path);
/* Tell the savefile code that we must not use setuid */
savefile_setuid = FALSE;
NeilStevens: Does ToME 3 work correctly? If so I'll apply this immediately. ToME 2 is unlikely to see another rleease unfortunately, but I'll leave that up to DG.
AnonymousHero: Please apply to ToME 2.x CVS in any case -- then people can at least get a working version from there. In ToME 3, modules.c is completely different, so I doubt that it's affected by this. How/where do I pester DG enough to get him to make another release of ToME 2? This bug makes ToME modules completely unplayable (the save/notes file/etc. paths are completely garbled), and ToME 3 was still unplayable by any reasonable standard the last time I tried (a10 I think).
BobVin: I've submitted a Debian bug report. My patch differs slightly because I worked out the solution on my own before finding this page (DOH! Four hours wasted!). Bug report (and my patch) available here:
ToME Wiki