Help has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Bug #854623

Improve handling of savegame load failure, particularly due to missing ruleset

Added by Jacob Nevins over 2 years ago. Updated over 2 years ago.

Start date:
Due date:
% Done:


Estimated time:


I accidentally tried loading a 2.6 savegame using ruleset 'augmented2' when I didn't have the ruleset available.

This went surprisingly badly:
  • The server carried on trying to a few bits of the savegame, such as treaties, even after it was obviously doomed for lack of ruleset. e.g.
    1: Failed to load ruleset
    1: Treaty between unknown players Joyce Banda and Koimala
    1: In secfile_lookup_str() [/home/jtn/src/freeciv/git26/utility/registry_ini.c:2043]: secfile '/tmp/freeciv-T0089-Y-0275-final.sav.bz2' in section 'NULL': "history.title" entry doesn't exist.
    1: Failure loading savegame!
  • The server was left in an unusable state.
    1: in send_ruleset_game() [/home/jtn/src/freeciv/git26/server/ruleset.c::6863]: assertion 'game.veteran != ((void *)0)' failed.
  • The client then segfaulted, trying to cope with a NULL game.plr_bg_color/
This patch addresses the server aspects. (For savegame2/3; I'm not touching the legacy pre-2.3 savegame code.)
  1. Add a bit more logging, to make it easier to spot the reason for failure to load the ruleset.
  2. Most sg_load_*() do a the standard sg_check_ret() at the start of the function, but a few did not. (Hence the random complaints about treaties for nonexistent players.)
  3. Change what happens at the end of a failed load attempt: since load_command() does server_game_free() / server_game_init(), do that again, then load a ruleset. (On S2_6, whatever is currently configured; sg_load_ruleset() will have left that sane.) I haven't thoroughly checked this is the right thing to do, but it's closer than what was there before, and seems to work.
    • (I'm not convinced the server implementation of game_reset() is useful for anything. This removes the only call.)
m-savegame-load-failure.patch (7.74 KB) m-savegame-load-failure.patch master Jacob Nevins, 2020-01-02 10:18 PM
30-savegame-load-failure.patch (7.41 KB) 30-savegame-load-failure.patch S3_0 Jacob Nevins, 2020-01-02 10:18 PM
26-savegame-load-failure.patch (3.47 KB) 26-savegame-load-failure.patch S2_6 Jacob Nevins, 2020-01-02 10:18 PM


#2 Updated by Jacob Nevins over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF