[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Update of bug #16800 (project freeciv): Status: Ready For Test = Fixed Open/Closed:Open = Closed ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #19, bug #16800 (project freeciv): I reproduced this crash many times. All with the same issue. Actually, the problem is not linked with moves, but it seems Leonardo's Workshop upgrade a Trireme on a tile with river to Caravel. Attached a modified savegame to reproduce the bug easily. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Additional Item Attachment, bug #16800 (project freeciv): File name: experimental_crash.sav.bz2 Size:112 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Update of bug #16800 (project freeciv): Status:None = Ready For Test ___ Follow-up Comment #20: Attached a modified savegame to reproduce the bug easily. Yes it does carchs immediately ... attached a patch which checks if an unit can survive after an upgrade. If not no upgrade is done. I add rebased versions of all 4 patches to this ticket. Which should be applied to which version? (file #11313, file #11314, file #11315, file #11316) ___ Additional Item Attachment: File name: 20101121-01-trunk-unit-check-for-NULL-pointer-in-can_unit_transport.patch Size:1 KB File name: 20101121-03-trunk-unit-Add-assertion-in-unit_type-to-catch-NULL-unit-p.patch Size:0 KB File name: 20101121-02-trunk-unit-check-if-unit-can-survive-before-moving-it.patch Size:2 KB File name: 20101121-04-trunk-unit-at-unit-upgrade-check-if-the-new-unit-can-survi.patch Size:1 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #21, bug #16800 (project freeciv): updated version (considering comment #18) (file #11317) ___ Additional Item Attachment: File name: 20101121-02-trunk-unit-check-if-unit-can-survive-before-moving-it.patch Size:2 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Update of bug #16800 (project freeciv): Assigned to:None = pepeto ___ Follow-up Comment #22: Attached an update of the last patch, according to patch #. (file #11319) ___ Additional Item Attachment: File name: 0006-Check-if-the-new-unit-can-survive-at-its-current-loc.patch Size:1 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Update of bug #16800 (project freeciv): Depends on: = patch # ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #15, bug #16800 (project freeciv): my try on a fix; I did not test it extensively but it should prevent a city bridge changes 20101103: * replace is_native_tile() by can_exist_at_tile() for point 4 of can_unit_move_to_tile(): 4) Unit can move to a tile where it can't survive on its own if there is city or free transport capacity. The asserts (file #11058, file #10546) should additionally be applied as they can help to find such errors in the future. (file #11077) ___ Additional Item Attachment: File name: 20101103-02-trunk-check-if-unit-can-survive-before-moving-it.patch Size:2 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Update of bug #16800 (project freeciv): Depends on: = patch #2160 ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #16, bug #16800 (project freeciv): the patch depends on patch #2160 due to the check added to tile_change_terrain(); else a lot of asserts will be shown due to the hacks which change the terrain to calculate the goodness of a possible change Should the test be included in #ifdef DEBUG / #endif? ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #17, bug #16800 (project freeciv): Should the test be included in #ifdef DEBUG / #endif? I can, but must not. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #18, bug #16800 (project freeciv): However, it should be included in a #ifndef NDEBUG because fc_assert has no effect when NDEBUG is defined. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #12, bug #16800 (project freeciv): See also bug #16994. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #13, bug #16800 (project freeciv): It should probably be forbidden to move to a city not adjacent to a native tile. At least, it would simplify it a lot. FYI that would break civ1 ruleset compatibility with civ1. It was common practice to build canals with cities next to each other in civ1. But those canals seem to be broken anyway (civ1 ruleset has been crashing, most likely because of them, for years) and I don't think civ1 compatibility is a high priority for us any more (not many people use it anyway as is obvious from the fact that I'm the only one who has filed bugs about those crashes) ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #14, bug #16800 (project freeciv): Attached my version for preventing unit_type() crash. Of course, it doesn't fix the item, but at least prevents the crash... (file #11058) ___ Additional Item Attachment: File name: 0002-Add-assertion-in-unit_type-to-catch-NULL-unit-pointe.patch Size:0 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #10, bug #16800 (project freeciv): In bug #15491, the check points about a string of cities that allow boats to cross the land. Should this be allowed or forbitten? ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #11, bug #16800 (project freeciv): It should probably be forbidden to move to a city not adjacent to a native tile. At least, it would simplify it a lot. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
URL: http://gna.org/bugs/?16800 Summary: Segmentation fault in unit_type() Project: Freeciv Submitted by: syntron Submitted on: Samstag 02.10.2010 um 13:06 Category: general Severity: 3 - Normal Priority: 5 - Normal Status: None Assigned to: None Originator Email: Open/Closed: Open Release: trunk Discussion Lock: Any Operating System: None Planned Release: 2.3.0 ___ Details: Core was generated by `./server/freeciv-server -r ./test016.serv -d 3 -l ./test016.log -p 6789'. Program terminated with signal 11, Segmentation fault. #0 unit_type (punit=0x0) at unittype.c:139 139 { (gdb) bt full #0 unit_type (punit=0x0) at unittype.c:139 No locals. #1 0x004f8754 in can_unit_transport (transporter=0x0, transported=value optimized out) at movement.c:507 No locals. #2 0x0049246b in check_units (file=0x5c02b8 srv_main.c, function=0x5c0fcc begin_turn, line=765) at sanitycheck.c:427 pcity = value optimized out phome = value optimized out transporter2 = (struct unit *) 0xbd9d70 ptile = (struct tile *) 0xd13298 transporter = (struct unit *) 0x0 myiter = (const struct genlist_link *) 0x1530c60 punit = (struct unit *) 0x1530ad0 pplayer = (struct player *) 0xfd5e30 _pslot = (struct player_slot *) 0xa68698 __FUNCTION__ = check_units #3 0x0049433e in real_sanity_check (file=0x5c02b8 srv_main.c, function=0x5c0fcc begin_turn, line=765) at sanitycheck.c:561 No locals. #4 0x0040c85b in srv_main () at srv_main.c:765 __FUNCTION__ = srv_main #5 0x004040c9 in main (argc=9, argv=0x7fff4ae53178) at civserver.c:372 inx = 9 showhelp = false showvers = false option = value optimized out __FUNCTION__ = main The function can_unit_transport() could be called with transporter == NULL in sanitycheck.c:check_units(). A proposal for a patch catching this is attached. ___ File Attachments: --- Date: Samstag 02.10.2010 um 13:06 Name: 20101002-trunk-check-for-NULL-pointer-in-can_unit_transport.patch Size: 1kB By: syntron http://gna.org/bugs/download.php?file_id=10546 ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #1, bug #16800 (project freeciv): Below some code from sanitycheck.c (line 403ff) is listed: if (punit-transported_by != -1) { transporter = game_find_unit_by_number(punit-transported_by); SANITY_CHECK(transporter != NULL); /* Make sure the transporter is on the tile. */ unit_list_iterate(punit-tile-units, tile_unit) { if (tile_unit == transporter) { transporter2 = tile_unit; } } unit_list_iterate_end; SANITY_CHECK(transporter2 != NULL); /* Also in the list of owner? */ SANITY_CHECK(player_find_unit_by_id(unit_owner(transporter), punit-transported_by) != NULL); SANITY_CHECK(same_pos(ptile, transporter-tile)); /* Transporter capacity will be checked when transporter itself * is checked */ } /* Check for ground units in the ocean. */ if (!can_unit_exist_at_tile(punit, ptile)) { SANITY_CHECK(punit-transported_by != -1); SANITY_CHECK(can_unit_transport(transporter, punit)); } The value for transporter is set in the first condition. But, in the second condition this value is used. At this point it will be NULL if the first one was not executed. Thus, the first sanity check fails and the second sanity check results in a core dump in unit_type() due to NULL-utype. From the log file: 1: [T063 - 2010/10/02 12:43:47] in begin_phase() [srv_main.c::827]: assertion 'punit-transported_by != -1 ' failed. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #2, bug #16800 (project freeciv): See also bug #15491. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #3, bug #16800 (project freeciv): What ruleset were you running? Maybe could you attach a savegame? ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #4, bug #16800 (project freeciv): I'm using the experimental ruleset and a serv file generated by a script (see test050.serv). But even using identical mapseed and gameseed I do not get the same result (the log file differs starting with turn 64). So I can give you a savefile where the bug is shown. (file #10555) ___ Additional Item Attachment: File name: test050.serv Size:0 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #5, bug #16800 (project freeciv): another try to solve this bug: * add a check to can_unit_move_to_tile(): can the unit survive at the destination tile? * transforming the terrain also needs a check; I did only add an assert (file #10556) ___ Additional Item Attachment: File name: 20100926-trunk-check-if-unit-can-survive-before-moving-it.patch Size:2 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #6, bug #16800 (project freeciv): wrong file ... (file #10557) ___ Additional Item Attachment: File name: 20101002v2-trunk-check-if-unit-can-survive-before-moving-it.patch Size:2 KB ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #7, bug #16800 (project freeciv): This patch seems unfortunately wrong. It will forbid units to go into transporters. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #8, bug #16800 (project freeciv): This patch seems unfortunately wrong. It will forbid units to go into transporters. Perhaps the point 2a should be moved after 4? 2a) The unit can survive on the target location. 4) Unit can move to non-native tile if there is city or free transport capacity. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #16800] Segmentation fault in unit_type()
Follow-up Comment #9, bug #16800 (project freeciv): In bug #15491, the check points about a string of cities that allow boats to cross the land. I don't know what causes the bug here. We must find what is the cause before attempting to fix it. ___ Reply to this item at: http://gna.org/bugs/?16800 ___ Message posté via/par Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev