"broken savefile" - WHAT THE HELL'S WRONG?! How do I recover my char?!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PowerDiver
    Prophet
    • Mar 2008
    • 2820

    #16
    Originally posted by Tiburon Silverflame
    It might be nice to have 2-tier saves...so the level-switch autosave is written to one file, while the game-exit or user-initiated save is written to a different file. But I don't think that's gonna get much support.
    Would changing the procedure to (1) write to a temporary savefile and then (2) rename the tmp to replace the original be good enough? I'd think that ought to be fairly robust.

    Comment

    • Sirridan
      Knight
      • May 2009
      • 560

      #17
      Originally posted by PowerDiver
      Would changing the procedure to (1) write to a temporary savefile and then (2) rename the tmp to replace the original be good enough? I'd think that ought to be fairly robust.
      Sounds like a good plan, if the os dies in the middle of the temp write, no problems. If it happens during the copy over, then there may be problems, so its a little much maybe but:

      1) Write to temp
      2) Rename the original
      3) Rename temp to the original name
      4) Delete the original

      Again, I may be overthinking things, but I'm not too keen on the differences between all the filesystems that may be in use. But in this case, at least some recent copy of the save should definitely be alive, unless the HDD catastrophically fails.

      Comment

      • Derakon
        Prophet
        • Dec 2009
        • 9022

        #18
        How about, if the game needs to make a panic save, saving it to a separate savefile. Then when the player tries to load their save, the game first tries the panic save. If it works, then the original save is removed and the panic save goes in its place; otherwise, the game silently fails over to the original save and the panic save is removed.

        Comment

        • Nemesis
          Adept
          • Jul 2009
          • 137

          #19
          Originally posted by buzzkill
          Just me, but I'd give it up. If you were going to win this game then you'll win another eventually. It just seems like a lot of work and cheating to get a somewhat questionable legitimate win.
          Don't you dare to question my legitimaty! Sure, I edited the files, but only to get my stuff back. When cleaning up killing orc, ogre and troll pits where all of the monsters were edited to have Saruman's drops, I ran into all kinds of items that survived Word of Destruction and/or had odd hit dice/armour rating, but I didn't identify a single item that I didn't have in my old game!

          Now, after lots and lots of hard work, I have my xp, stats, artifacts and rings/boots of speed and dungeon spell books again, but I still lack my big collection of Healing/*Healing*/Life potions, *Destruction*/Banishment/Mass Banishment scrolls.

          My win would be questionable if I was to boast about having a low turncount, but I couldn't care less about my turncount, I'm just excited because I have a chance of winning Angband!

          Originally posted by buzzkill
          What ancient version of windows are you running that crashed? I can't remember the last time windows crashed on me.
          Running Vista on a laptop that I've had running day and night for a year and a half, while my computer might not be in Ragnarök yet, it's certainly in its Fimbular Winter.

          Comment

          • ramela
            Apprentice
            • Jan 2008
            • 55

            #20
            What you consider questionable might differ from what others see as questionable and you shouldn't snap at other people for voicing their opinions.

            Everyone gets to have their own opinion on what is a legimate win and what is not, even if you were hurt by your computer crash.

            Comment

            • takkaria
              Veteran
              • Apr 2007
              • 1951

              #21
              Originally posted by PowerDiver
              Would changing the procedure to (1) write to a temporary savefile and then (2) rename the tmp to replace the original be good enough? I'd think that ought to be fairly robust.
              We already write to savefile.new, then move savefile to savefile.old, then move savefile.new to savefile, then delete savefile.(old|new), checking for errors and issues at each step. Windows is just an arse.
              takkaria whispers something about options. -more-

              Comment

              • LostTemplar
                Knight
                • Aug 2009
                • 670

                #22
                Without use of fsync() this did not help, atleast with ext4 filesystem, allmost any system crash or power down results in broken savefile. I never had any problems under windows.

                Comment

                • d_m
                  Angband Devteam member
                  • Aug 2008
                  • 1517

                  #23
                  Originally posted by LostTemplar
                  Without use of fsync() this did not help, atleast with ext4 filesystem, allmost any system crash or power down results in broken savefile. I never had any problems under windows.
                  Check out the "Disadvantages" section of this article on ext4:

                  linux->xterm->screen->pmacs

                  Comment

                  • Tiburon Silverflame
                    Swordsman
                    • Feb 2010
                    • 405

                    #24
                    The 2-tier approach I'm suggesting would use 2 completely separate *files*. So if I'm using Tiburon as my character, the level-switched save might be Tiburon.level, while the user-invoked or game-exit save might be Tiburon. That way, no matter what happens, you have 1 file that is no more than a single level old, which is safe.

                    Comment

                    • Pete Mack
                      Prophet
                      • Apr 2007
                      • 6883

                      #25
                      Originally posted by LostTemplar
                      Without use of fsync() this did not help, atleast with ext4 filesystem, allmost any system crash or power down results in broken savefile. I never had any problems under windows.
                      This is correct.
                      Before renaming the file, force a disk sync--standard practice for editor apps and databases. For a panic save file, it's a good idea to reopen it and verifying that it is valid before renaming.

                      Comment

                      • Nemesis
                        Adept
                        • Jul 2009
                        • 137

                        #26
                        Originally posted by ramela
                        What you consider questionable might differ from what others see as questionable and you shouldn't snap at other people for voicing their opinions.

                        Everyone gets to have their own opinion on what is a legimate win and what is not, even if you were hurt by your computer crash.
                        Try not to snap yourself when in this situation!

                        Comment

                        • Derakon
                          Prophet
                          • Dec 2009
                          • 9022

                          #27
                          Originally posted by Pete Mack
                          This is correct.
                          Before renaming the file, force a disk sync--standard practice for editor apps and databases. For a panic save file, it's a good idea to reopen it and verifying that it is valid before renaming.
                          This sounds basically like what I suggested, right? Validate save, if it's good, replace old save with it, otherwise, use old save.

                          Comment

                          • Tiburon Silverflame
                            Swordsman
                            • Feb 2010
                            • 405

                            #28
                            I still see some issues...

                            First, some of this tends to be OS-specific, or at least the calls to implement the disk sync, are likely to be OS-specific.

                            Second, it still feels like the process that Pete/Derakon are mentioning, is potentially subject to crashes at the wrong time. It might be *safer*...but it's not safe.

                            Comment

                            • ramela
                              Apprentice
                              • Jan 2008
                              • 55

                              #29
                              Originally posted by Nemesis
                              Try not to snap yourself when in this situation!
                              Well, this has happened to me twice. Both times I did snap, but in private.

                              Then I just started over.

                              Comment

                              • Derakon
                                Prophet
                                • Dec 2009
                                • 9022

                                #30
                                Tiburon: to my knowledge, moving a file is an atomic operation on all filesystems -- that is to say, it either succeeds, or it doesn't happen at all. So if you have two files "goodsave" and "panicsave" and you try to move panicsave over goodsave (having previously validated panicsave is a valid savefile), then there's nothing, that will corrupt panicsave that wouldn't also screw over your entire hard drive (i.e. catastrophic hardware failure).

                                Writing a file isn't an atomic operation, which is why panicsaves are not reliable in the first place.

                                Comment

                                Working...
                                😀
                                😂
                                🥰
                                😘
                                🤢
                                😎
                                😞
                                😡
                                👍
                                👎