Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-11 Thread Christian Knoke

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 


Hello,

this looks a bit different, so maybe this is of help for you:

[EMAIL PROTECTED]:~$ file .freeciv/saves/Afrika-0075m.sav.gz
.freeciv/saves/Afrika-0075m.sav.gz: gzip compressed data, from Unix
[EMAIL PROTECTED]:~$ zless .freeciv/saves/Afrika-0075m.sav.gz
[EMAIL PROTECTED]:~$ civserver -f .freeciv/saves/Afrika-0075m.sav.gz
Freeciv Version 2.1.99-test Server
Weitere Informationen zu Freeciv finden Sie auf http://www.freeciv.org/.
2: Lade Regelsätze
2: AI*0 ist als KI-Spieler mit dem Level 'Fortgeschritten' dazu gekommen.
2: AI*1 ist als KI-Spieler mit dem Level 'Fortgeschritten' dazu gekommen.
2: AI*2 ist als KI-Spieler mit dem Level 'Fortgeschritten' dazu gekommen.
0: Detected fatal error in savegame.c line 303:
0: Unknown ascii value for num: '?' 63
civserver: shared.c:772: real_die: Zusicherung »0« nicht erfüllt.
Abgebrochen (core dumped)

[EMAIL PROTECTED]:~$ gdb civserver -c core
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i486-linux-gnu...Using host libthread_db
library /lib/tls/i686/cmov/libthread_db.so.1.


warning: Can't read pathname for load map: Eingabe-/Ausgabefehler.
Reading symbols from /lib/libreadline.so.5...done.
Loaded symbols for /lib/libreadline.so.5
Reading symbols from /lib/tls/i686/cmov/libm.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libm.so.6
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/libncurses.so.5...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/tls/i686/cmov/libdl.so.2...done.
Loaded symbols for /lib/tls/i686/cmov/libdl.so.2
Core was generated by `civserver -f .freeciv/saves/Afrika-0075m.sav.gz'.
Program terminated with signal 6, Aborted.
#0  0xb7f64410 in ?? ()
(gdb) bt full
#0  0xb7f64410 in ?? ()
No symbol table info available.
#1  0xbfcc2c28 in ?? ()
No symbol table info available.
#2  0x0006 in ?? ()
No symbol table info available.
#3  0x335b in ?? ()
No symbol table info available.
#4  0xb7dd9811 in raise () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#5  0xb7ddafb9 in abort () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#6  0xb7dd2fbf in __assert_fail () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#7  0x0804dfad in real_die (file=0x818ebfd savegame.c, line=303,
format=0x81920bc Unknown ascii value for num: '%c' %d) at shared.c:772
ap = 0xbfcc2ddc ?
__PRETTY_FUNCTION__ = real_die
#8  0x080ffe9e in player_load_units (plr=0x82adec8, plrno=0,
#file=0xbfcc53d0,
savefile_options=0x82d9468  attributes client_worklists
#diplchance_percent embassies improvement_order known32fix map_editor orders
resources rulesetdir rulesets spacerace2 startoptions startunits
#technology_order turn turn_las..., base_order=0x85c7418) at savegame.c:303
order = (struct unit_order *) 0x84b1f70
pbase = value optimized out
orders_buf = 0x830c8f0 m
dir_buf = value optimized out
act_buf = value optimized out
base_buf = 0x830c998 ?
len = 5
nunits = 37
i = 0
j = 0
activity = value optimized out
#9  0x08104be5 in game_load_internal (file=0xbfcc53d0) at savegame.c:4583
p = 0x830bea9 
j = value optimized out
named = player0.c15.name\000\000\032\b\034\226۷�*-\bH)-
past = (struct player *) 0x0
kind = value optimized out
id = value optimized out
k = value optimized out
---Type return to continue, or q return to quit---
ncities = 16
name = value optimized out
i = 16
n = 0
pplayer = (struct player *) 0x82adec8
i = value optimized out
k = value optimized out
rstate = {v = {3483144510, 4149434778, 616945146, 3983220155,
2524127079, 4245523835, 58694983,
2502313567, 1632024145, 622805316, 3220350491, 2643454244, 4225382234,
4088774264, 2182431222, 3232741472,
3639874635, 2182188660, 287460, 237971662, 1143670015, 2844288896,
3741617436, 2179684885, 327247759,
2227991261, 800633405, 2585865354, 3117939903, 3117430286, 2619047182,
2966979254, 1453378170, 1367937921,
615603337, 1043026935, 584316410, 1279935614, 3511316146, 1226841590,
2134732736, 42320694, 661506010,
3919593762, 2269939074, 39015563, 2487614338, 3050839058, 1949631683,
3093259531, 2124711708, 3740016727,
3828366745, 898243122, 

Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-11 Thread Christian Knoke

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

me wrote on Oct 11, 13:05 (-0700):

 this looks a bit different, so maybe this is of help for you:

 civserver: shared.c:772: real_die: Zusicherung »0« nicht erfüllt.
 Abgebrochen (core dumped)

sorry if this is old news for you, I haven't followed the discussion.

civclient can't load games because of confusion with the name:

chris: '/load /home/chris/.freeciv/saves/Afrika-0075m.sav'
3: sending packet type=PACKET_CHAT_MSG(18) len=62
3: Could not find readable file
/home/chris/.freeciv/saves/Afrika-0075m.sav.sav in data path.
3: Could not find readable file
/home/chris/.freeciv/saves/Afrika-0075m.sav.sav.gz in data path.
3: Could not find readable file
scenario//home/chris/.freeciv/saves/Afrika-0075m.sav.sav in data path.
3: Could not find readable file
scenario//home/chris/.freeciv/saves/Afrika-0075m.sav.sav.gz in data path.

or

chris: '/load /home/chris/.freeciv/saves/Afrika-0075.sav.'
3: sending packet type=PACKET_CHAT_MSG(18) len=62
3: Could not find readable file
/home/chris/.freeciv/saves/Afrika-0075.sav..sav in data path.
3: Could not find readable file
/home/chris/.freeciv/saves/Afrika-0075.sav..sav.gz in data path.
3: Could not find readable file
scenario//home/chris/.freeciv/saves/Afrika-0075.sav..sav in data path.
3: Could not find readable file
scenario//home/chris/.freeciv/saves/Afrika-0075.sav..sav.gz in data path.

Some of these games can be loaded and played with civserver -f ..., some others 
not.

I have:

Afrika-0050m.sav.gz
Afrika-0050.sav.gz
Afrika-0075m.sav.gz
Afrika-0075.sav.gz

The manually saved games can't be loaded with civserver -f ..., the others
can. This is a pattern. If you need saves, logs, dumps, tell me.

HTH,
Christian

-- 
Christian Knoke* * *http://cknoke.de
* * * * * * * * *  Ceterum censeo Microsoft esse dividendum.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-10 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

2008/10/10 Madeline Book:

 I'm guessing that game.control.num_base_types should be used
 instead, but even so this sounds suspicious since base_order
 is allocated with size nmod + (4 - (nmod % 4)) where nmod is
 loaded from the savegame (maybe nmod should be replaced by
 game.control.num_base_types in the calloc call?).

 Note that ruleset, and thus game.control.num_bases, may has changed
between saving and loading. Freeciv savegames are supposed to be
backward compatible over a couple of versions.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-10 Thread Egor Vyscrebentsov

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

On Thu, 9 Oct 2008 Madeline Book wrote:

 The missing '\0' at the end of base_buf seems to be the main
 bug;

No, all chars after strlen(order_list)-1 aren't processed. So this is
just a non-orderliness, which doesn't affect game loading.

 There seems to be another mistake though, and that is concerning
 the two uses of sizeof on a dynamically allocated array:

   sizeof(base_order) / sizeof(struct base_type *)

 Since base_order has type struct base_type ** the dividend
 will always evaluate to the size of a pointer, which is the
 same as the value of the divisor. So the whole expression will
 always evaluate to one (which I think is not the desired
 behaviour).

Ooh... but I want to count this as another bug, let's go on with
it in another ticket (and with author of this code).

 I'm guessing that game.control.num_base_types should be used
 instead, but even so this sounds suspicious since base_order
 is allocated with size nmod + (4 - (nmod % 4)) where nmod is
 loaded from the savegame (maybe nmod should be replaced by
 game.control.num_base_types in the calloc call?).

There may be a problem that bases list from savegame can differ
from ruleset's one. I guess that game.control.num_base_types is
loaded from ruleset (the only place where I can see it changed
is in server/ruleset.c).

[side note]
Speaking of nmod, am I right that if nmod % 4 == 0 aligning
will add extra four positions? (nmod + 3 - (nmod - 1) % 4) should
be nearest alignment, right?
Also, in loading map specials there is potential crash. I use
next change since first attemtps of loading games converted
from civ2 (aligned nmod was smaller than aligned S_LAST that time.)

@@ -4049,7 +4049,7 @@
   special_order[j] = find_special_by_rule_name(modname[j]);
 }
 free(modname);
-for (; j  S_LAST + (4 - (S_LAST % 4)); j++) {
+for (; j  S_LAST + (4 - (S_LAST % 4))  j  nmod + (4 - (nmod % 4)); 
j++) {
   special_order[j] = S_LAST;
 }
   }

But this is really for another ticket.
[/side note]

  There should be some action after each of two added LOG_ERRORs.
  One variant is to abort civserver. Opinions?
 
 If there's no easy way to handle the error after the error
 message (e.g. just dropping the orders for the unit)

Of course, it is. It's even already implemented several lines
above. Attached (with small change in symbol checking.)

-- 
Thanks, evyscr

Index: server/savegame.c
===
--- server/savegame.c	(revision 15253)
+++ server/savegame.c	(working copy)
@@ -1859,20 +1859,42 @@
 /* Either ACTIVITY_FORTRESS or ACTIVITY_AIRBASE */
 order-activity = ACTIVITY_BASE;
 order-base = base_number(pbase);
-  } else if (base_buf) {
-base = char2num(base_buf[j]);
+	  } else if (order-activity == ACTIVITY_BASE) {
+	if (base_buf) {
+	  if (strchr(num_chars, base_buf[j])) {
+		base = char2num(base_buf[j]);
 
-if (base = 0
- base  sizeof(base_order) / sizeof (struct base_type *)) {
-  pbase = base_order[base];
-} else {
-  freelog(LOG_ERROR, Cannot find base %d for %s to build,
-  base, unit_rule_name(punit));
-  base = base_number(get_base_by_gui_type(BASE_GUI_FORTRESS, NULL, NULL));
-}
+		if (base = 0
+		 base  sizeof(base_order) / sizeof (struct base_type *)) {
+		  pbase = base_order[base];
+		} else {
+		  freelog(LOG_ERROR, Cannot find base %d for %s [%d] to build,
+			  base, unit_rule_name(punit), punit-id);
+		  base = base_number(get_base_by_gui_type(BASE_GUI_FORTRESS, NULL, NULL));
+		}
 
-order-base = base;
-  }
+		order-base = base;
+	  } else {
+		freelog(LOG_ERROR,
+			%s [%d] has ACTIVITY_BASE but wrong base char
+			 is in base_list. Dropping orders.,
+			unit_rule_name(punit), punit-id);
+		free(punit-orders.list);
+		punit-orders.list = NULL;
+		punit-has_orders = FALSE;
+		break;
+	  }
+	} else {
+	  freelog(LOG_ERROR,
+		  %s [%d] has ACTIVITY_BASE but no base_list present.
+		   Dropping orders.,
+		  unit_rule_name(punit), punit-id);
+	  free(punit-orders.list);
+	  punit-orders.list = NULL;
+	  punit-has_orders = FALSE;
+	  break;
+	}
+	  }
 	}
   } else {
 	punit-has_orders = FALSE;
@@ -3470,7 +3492,7 @@
 	  break;
 	}
   }
-  orders_buf[len] = dir_buf[len] = act_buf[len] = '\0';
+  orders_buf[len] = dir_buf[len] = act_buf[len] = base_buf[len] = '\0';
 
   secfile_insert_str(file, orders_buf,
 			 player%d.u%d.orders_list, plrno, i);
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-09 Thread Egor Vyscrebentsov

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

On Tue, 7 Oct 2008 Joan Creus wrote:

 2008/10/7 Egor Vyscrebentsov evyscr/gmail.com
 
  base_list (and therefore base_buf) for archers at [39,40] (line 1278)
  is ��x�ſ-�\017\b\214�ſ �\b��. Most of these symbols are illegal.
 
  activity_list for same unit is . Wonder if this was one more
  out-of-pointer'ing?
 
  orders_list and dir_list also look strange.

orders_list and dir_list are ok.

 It looks like the problem my be in the saving rather than in the loading?

Yes. The problem is in player_save_units() and player_load_units().
player_save_units() set target base char to '?', and this char isn't
changed in several cases. player_load_units() assumes that loaded
char is one of [0-9a-f].

Quickest (not the best) fix is 

-  } else if (base_buf) {
+  } else if (base_buf  base_buf[j] != '?') {

at server/savegame.c:1862

This is the first part of problem. The second part is that in
savegame file base_list is longer than activity_list. Now I have
no idea why.

-- 
Thanks, evyscr



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-09 Thread Egor Vyscrebentsov

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

On Thu, 9 Oct 2008 Egor Vyscrebentsov wrote:

 On Tue, 7 Oct 2008 Joan Creus wrote:

  2008/10/7 Egor Vyscrebentsov evyscr/gmail.com
  
   base_list (and therefore base_buf) for archers at [39,40] (line 1278)
   is ��x�ſ-�\017\b\214�ſ �\b��. Most of these symbols are illegal.
  
   activity_list for same unit is . Wonder if this was one more
   out-of-pointer'ing?
  
  It looks like the problem my be in the saving rather than in the loading?

 Yes. The problem is in player_save_units() and player_load_units().
 player_save_units() set target base char to '?', and this char isn't
 changed in several cases. player_load_units() assumes that loaded
 char is one of [0-9a-f].
 
 Quickest (not the best) fix is 
 
 -  } else if (base_buf) {
 +  } else if (base_buf  base_buf[j] != '?') {
 
 at server/savegame.c:1862

After some thoughts I've decided that this fix is proper.

 This is the first part of problem. The second part is that in
 savegame file base_list is longer than activity_list.

-  orders_buf[len] = dir_buf[len] = act_buf[len] = '\0';
+  orders_buf[len] = dir_buf[len] = act_buf[len] = base_buf[len] = '\0';

at server/savegame.c:3473

-- 
Thanks, evyscr



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-09 Thread Joan Creus

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

I have applied the patch, and started a new game. It didn't make any
difference, and I still couldn't load any of the saved files.

Then I have started ./civ with the --log option, and the problem was in
fact:

3: Could not find readable file
/home/joanc/.freeciv/saves/anemdeconya.sav..sav in data path.
3: Could not find readable file
/home/joanc/.freeciv/saves/anemdeconya.sav..sav.gz in data path.

So most of the problem is really the way the filename to open gets
generated. Your patch may still fix the problem that generated all the
popups, I suppose.

Thanks,

Joan


2008/10/9 Egor Vyscrebentsov [EMAIL PROTECTED]


 URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

 On Thu, 9 Oct 2008 Egor Vyscrebentsov wrote:
  On Thu, 9 Oct 2008 Egor Vyscrebentsov wrote:
 
   Quickest (not the best) fix is
  
   -  } else if (base_buf) {
   +  } else if (base_buf  base_buf[j] != '?') {
  
   at server/savegame.c:1862
 
  After some thoughts I've decided that this fix is proper.

 And after some more thoughts I've decided opposite...
 Patch with more or less accurate workaround is attached.

 There should be some action after each of two added LOG_ERRORs.
 One variant is to abort civserver. Opinions?

 --
 Thanks, evyscr



I have applied the patch, and started a new game. It didnt make any difference, and I still couldnt load any of the saved files.Then I have started ./civ with the --log option, and the problem was in fact:
3: Could not find readable file /home/joanc/.freeciv/saves/anemdeconya.sav..sav in data path.3: Could not find readable file /home/joanc/.freeciv/saves/anemdeconya.sav..sav.gz in data path.
So most of the problem is really the way the filename to open gets generated. Your patch may still fix the problem that generated all the popups, I suppose.Thanks,Joan
2008/10/9 Egor Vyscrebentsov [EMAIL PROTECTED]

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

On Thu, 9 Oct 2008 Egor Vyscrebentsov wrote:
 On Thu, 9 Oct 2008 Egor Vyscrebentsov wrote:

  Quickest (not the best) fix is
 
  - } else if (base_buf) {
  + } else if (base_buf  base_buf[j] != ?) {
 
  at server/savegame.c:1862

 After some thoughts Ive decided that this fix is proper.

And after some more thoughts Ive decided opposite...
Patch with more or less accurate workaround is attached.

There should be some action after each of two added LOG_ERRORs.
One variant is to abort civserver. Opinions?

--
Thanks, evyscr


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-07 Thread Egor Vyscrebentsov

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

On Mon, 6 Oct 2008 15:34:55 -0700 Joan Creus wrote:

 This transaction appears to have no content

[*sigh*]

 I saved a game on 2.2, SVN 15240. Now, when I try to load it, I get four
 popups:

 1) Detected fatal error in savegame.c line 303:
 2) Please report this message at http://bugs.freeciv.org
 3) Unknown ascii value for num: '?' 63
 2) Please report this message at http://bugs.freeciv.org

 The server exits, too.

base_list (and therefore base_buf) for archers at [39,40] (line 1278)
is ��x�ſ-�\017\b\214�ſ �\b��. Most of these symbols are illegal.

What are your system/encoding?
Is there a previous savegame that loads normally?

activity_list for same unit is . Wonder if this was one more
out-of-pointer'ing?

Phalanx at [45,45] (line 1279) has the same problems. Looks like these
units are the only that have base_list and activity_list differ from '-'.

orders_list and dir_list also look strange.

Error message may be improved. I guess that telling wrong
element/line of savegame might be useful when working with
scenario.

-- 
Thanks, evyscr



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40517) Can't load savegames in 2.2

2008-10-07 Thread Joan Creus

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 

2008/10/7 Egor Vyscrebentsov [EMAIL PROTECTED]


 URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 


 base_list (and therefore base_buf) for archers at [39,40] (line 1278)
 is ��x�ſ-�\017\b\214�ſ �\b��. Most of these symbols are illegal.

 What are your system/encoding?


It's a kubuntu 8.04, up-to date, on an Acer Travelmate 290. My encoding is
ca_ES.UTF-8.


 Is there a previous savegame that loads normally?


This was the first time I was playing 2.2. No game saved under 2.2 can be
loaded, neither by 2.2 or 2.1. 2.2 can't load any savegame, even the ones
created under 2.1 that can be loaded by 2.1. Furthermore, there's one file
that generates that series of popups.



 activity_list for same unit is . Wonder if this was one more
 out-of-pointer'ing?

 Phalanx at [45,45] (line 1279) has the same problems. Looks like these
 units are the only that have base_list and activity_list differ from '-'.

 orders_list and dir_list also look strange.


It looks like the problem my be in the saving rather than in the loading?



 Error message may be improved. I guess that telling wrong
 element/line of savegame might be useful when working with
 scenario.


Well, this is not supposed to happen when the game is released, right? I
wouldn't worry about this too much.

Thanks,

Joan

2008/10/7 Egor Vyscrebentsov [EMAIL PROTECTED]

URL: http://bugs.freeciv.org/Ticket/Display.html?id=40517 


base_list (and therefore base_buf) for archers at [39,40] (line 1278)
is ��x�ſ-�\017\b\214�ſ �\b��. Most of these symbols are illegal.

What are your system/encoding?Its a kubuntu 8.04, up-to date, on an Acer Travelmate 290. My encoding is ca_ES.UTF-8.

Is there a previous savegame that loads normally?This was the first time I was playing 2.2. No game saved under 2.2 can be loaded, neither by 2.2 or 2.1. 2.2 cant load any savegame, even the ones created under 2.1 that can be loaded by 2.1. Furthermore, theres one file that generates that series of popups.


activity_list for same unit is . Wonder if this was one more
out-of-pointering?

Phalanx at [45,45] (line 1279) has the same problems. Looks like these
units are the only that have base_list and activity_list differ from -.

orders_list and dir_list also look strange.
It looks like the problem my be in the saving rather than in the loading?

Error message may be improved. I guess that telling wrong
element/line of savegame might be useful when working with
scenario.Well, this is not supposed to happen when the game is released, right? I wouldnt worry about this too much. Thanks, Joan
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev