]> granicus.if.org Git - nethack/commitdiff
wizard bones bug (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 28 Jan 2012 02:52:14 +0000 (02:52 +0000)
committernethack.rankin <nethack.rankin>
Sat, 28 Jan 2012 02:52:14 +0000 (02:52 +0000)
     The wizard mode sequence
  load bones? y, unlink bones? y, die, save bones? y
works, but
  load bones? y, unlink bones? n, die, save bones? y, replace old bones? y
fails if/when external compression is in use.  The file gets uncompressed
before being opened to check its existence, then immediately closed, and
re-compressed, changing the file's name, before the deletion attempt takes
place.  Then delete_bonesfile() can't find it via the uncompressed name
and the bones saving code reports "cannot unlink old bones".

     The code involved doesn't seem to have changed since the current cvs
repository was set up, so this bug has gone unnoticed for a long time.
There's no reason this fix shouldn't go into the branch too, other than the
fact that I don't have that checked out on this machine.  If someone wants
to apply it there, be my guest (and move the fixes entry to fixes34.4).

doc/fixes35.0
src/bones.c

index e3d5965cb2986bba502ce8405766e606c77d8214..f558c3c66e0d69c5ca4b2cc2804546d6396a5798 100644 (file)
@@ -402,6 +402,8 @@ hangup save made during magic mapping or <foo> detection performed while
        underwater could put hero on top of the water after restore
 items conferring life drain resistance were affected by drain life spell
 'a'pply command could be used to recogniize undiscovered potions of oil
+fix replacing an existing bones file in wizard mode [load?y, unlink?n, die?y,
+       save?y, replace?y] for configurations using external file compression
 
 
 Platform- and/or Interface-Specific Fixes
index 8358490cfdc2c3a1341b8f79956dfaba913ace84..b762e5a00feaf2c9d5443fc8e8b04ac5f6b927b6 100644 (file)
@@ -293,7 +293,6 @@ struct obj *corpse;
        fd = open_bonesfile(&u.uz, &bonesid);
        if (fd >= 0) {
                (void) close(fd);
-               compress_bonesfile();
 #ifdef WIZARD
                if (wizard) {
                    if (yn("Bones file already exists.  Replace it?") == 'y') {
@@ -302,6 +301,9 @@ struct obj *corpse;
                    }
                }
 #endif
+               /* compression can change the file's name, so must
+                  wait until after any attempt to delete this file */
+               compress_bonesfile();
                return;
        }