[Freeciv-Dev] (PR#39565) NULL instead of valid impr_type in punittype-need_improvement

2007-11-04 Thread William Allen Simpson

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

As explained in PR#39385, this is exactly the kind of bug that PR#39553
was intended to catch.  The old code didn't check for a valid
improvement before using it.  The fix was much easier than removing the
useful log, or writing this report  Your patch is reverted.

+ } else if (NULL == impr_req) {
+ CITY_LOG(LOG_DEBUG, pcity, cannot build unit %s,
+ utype_rule_name(punittype));




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


Re: [Freeciv-Dev] (PR#39565) NULL instead of valid impr_type in punittype-need_improvement

2007-08-19 Thread Marko Lindqvist

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

On 14/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  I will commit attached patch immediately to avoid actual crash. Bug
 must still be fixed and this patch should be reverted after that.

 I run game without that emergency fix to get backtrace. This is from
latest TRUNK (r13356)

#0  0x00475f50 in skip_intl_qualifier_prefix (
str=0x10 Address 0x10 out of bounds) at
../../src.patched/utility/fcintl.c:43
ptr = 0x420481 ¥203ð¥001¥204タt¥tヌEì
#1  0x0040c6a5 in improvement_rule_name (pimprove=0x0)
at ../../src.patched/common/improvement.c:225
No locals.
#2  0x004f234d in process_attacker_want (pcity=0x13be720, value=30,
victim_unit_type=0x82b0f8, victim_player=0x8d9c10, veteran=0,
ptile=0xa57ab8,
best_choice=0x7fff2cc21e80, boat=0x0, boattype=0x0)
at ../../src.patched/ai/advmilitary.c:1040
vuln = 25
will_be_veteran = 1
desire = 472
want = 365
move_time = 1
tech_cost = 0
move_rate = 12
bcost_balanced = 66
bcost = 50
attack = 1600
impr_req = (struct impr_type *) 0x0
tech_req = 44
tech_dist = 0
move_type = 2
punittype = (struct unit_type *) 0x831ff8
m_c = 25
pplayer = (struct player *) 0x8d4730
acity = (struct city *) 0x0
shore = true
orig_move_type = 2
victim_count = 1
needferry = 0
unhap = false
__PRETTY_FUNCTION__ = process_attacker_want
#3  0x004f29c9 in kill_something_with (pplayer=0x8d4730,
pcity=0x13be720,
myunit=0x143ad20, choice=0x13bf4f8) at
../../src.patched/ai/advmilitary.c:1210
ai = (struct ai_data *) 0x89ae30
attack = 1600
benefit = 30
pdef = (struct unit *) 0x143b110
def_type = (struct unit_type *) 0x82b0f8
def_owner = (struct player *) 0x8d9c10
def_vet = 0
ptile = (struct tile *) 0xa57ab8
ferryboat = (struct unit *) 0x0
acity = (struct city *) 0x0
boattype = (struct unit_type *) 0x0
go_by_boat = false
best_choice = {type = CT_ATTACKER, value = {advance = 0x8326e8,
govern = 0x8326e8, building = 0x8326e8, nation = 0x8326e8,
specialist = 0x8326e8,
terrain = 0x8326e8, uclass = 0x8326e8, utype = 0x8326e8, ai_level
= 8595176,
minsize = 8595176, outputtype = 8595176, terrainclass = 8595176,
special = 8595176, unitclassflag = 8595176, unitflag = 8595176},
want = 363,
  need_boat = false}
__PRETTY_FUNCTION__ = kill_something_with
#4  0x004f32cd in military_advisor_choose_build (pplayer=0x8d4730,
pcity=0x13be720, choice=0x13bf4f8) at
../../src.patched/ai/advmilitary.c:1467
ai = (struct ai_data *) 0x89ae30
punittype = (struct unit_type *) 0x8326e8
our_def = 288369
urgency = 23
ptile = (struct tile *) 0xa5c360
virtualunit = (struct unit *) 0x143ad20
#5  0x004fde38 in ai_manage_cities (pplayer=0x8d4730)
at ../../src.patched/ai/aicity.c:1676
myiter = (struct genlist_link *) 0x0
pcity = (struct city *) 0x13be720
#6  0x00505c34 in ai_do_last_activities (pplayer=0x8d4730)
at ../../src.patched/ai/aihand.c:463
No locals.
#7  0x00480b44 in end_phase () at
../../src.patched/server/srv_main.c:723
pplayer = (struct player *) 0x8d4730
pplayer_index = 6
#8  0x00482c7f in main_loop () at
../../src.patched/server/srv_main.c:1769
eot_timer = (struct timer *) 0xc5ca30
save_counter = 18
is_new_turn = true
__PRETTY_FUNCTION__ = main_loop
#9  0x0048348c in srv_loop () at
../../src.patched/server/srv_main.c:2044
__PRETTY_FUNCTION__ = srv_loop
#10 0x00482e2e in srv_main () at
../../src.patched/server/srv_main.c:1851
No locals.
#11 0x00403ee4 in main (argc=3, argv=0x7fff2cc222e8)
at ../../src.patched/server/civserver.c:262
inx = 3
showhelp = false
showvers = false
option = 0x8ff1b0 ../autogames/regression.serv


 - ML



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


[Freeciv-Dev] (PR#39565) NULL instead of valid impr_type in punittype-need_improvement

2007-08-14 Thread Marko Lindqvist

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

 At least I guess crash was caused by $subject.

 I will commit attached patch immediately to avoid actual crash. Bug
must still be fixed and this patch should be reverted after that.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c	2007-08-14 13:52:16.0 +0300
+++ freeciv/ai/advmilitary.c	2007-08-14 14:35:40.0 +0300
@@ -1038,9 +1038,13 @@
 best_choice-type = CT_BUILDING;
   } else {
 	/* This should never happen? */
+/* FIXME: Restore this when bug causing it to crash is fixed.
+ *Commented out just as a critical fix to avoid crash. */
+#if 0
 CITY_LOG(LOG_DEBUG, pcity, cannot build %s or %s,
  improvement_rule_name(impr_req),
  utype_rule_name(punittype));
+#endif
 	  }
 }
   }
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev