[Freeciv-Dev] [bug #17265] Successful attacking diplomat does not get promotion.

2010-12-08 Thread George Koehler

Follow-up Comment #5, bug #17265 (project freeciv):

I recall that I was able to promote my diplomats by bribing enemy units.

The question is whether I can promote my diplomats by eliminating enemy
diplomats in cities. I opened a game with S2_3 and used the editing mode to
put diplomats. When I eliminate a diplomat (with the message "An enemy
Diplomat has been eliminated by your Diplomat.") then my diplomat survives,
but never gets a promotion.

I guess that the only way for a diplomat to survive, after taking an action
against a city, is to eliminate a defending diplomat. All other actions
against a city do disband the attacking diplomat.

___

Reply to this item at:

  

___
  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 #17193] in unquote_block() [savegame2.c::990]: assertion '1 == parsed' failed

2010-12-07 Thread George Koehler

Follow-up Comment #5, bug #17193 (project freeciv):

I saw this bug with S2_3 r18705. I would like to thank you all for already
reporting the bug and posting a fix. Pepeto's fix (comment #4) works for me.

___

Reply to this item at:

  

___
  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 #17247] Wrong comment in server/prlhand.c split_player()

2010-12-06 Thread George Koehler

URL:
  

 Summary: Wrong comment in server/prlhand.c split_player()
 Project: Freeciv
Submitted by: kernigh
Submitted on: Mon 06 Dec 2010 09:41:51 PM GMT
Category: ai
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_2 r18700
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

The following comment in split_player() of server/plrhand.c of S2_2 r18700 is
wrong.


  cplayer = server_create_player();
  ...
  /* cplayer is not yet part of players_iterate which goes only
 to player_count(). */
  players_iterate(other_player) {
...


cplayer is part of players_iterate because server_create_player() added 1 to
the count. I verified this by inserting an assertion:


  cplayer = server_create_player();
  ...
  /* cplayer is not yet part of players_iterate which goes only
 to player_count(). */
  players_iterate(other_player) {
assert(cplayer != other_player);
...


The assertion failed.

I am not sure if the fix is only to change the comment, or also to skip some
code if cplayer == other_player?




___

Reply to this item at:

  

___
  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 #17201] Civil war rebels have no capital city

2010-11-29 Thread George Koehler

URL:
  

 Summary: Civil war rebels have no capital city
 Project: Freeciv
Submitted by: kernigh
Submitted on: Monday 11/29/2010 at 21:16
Category: ai
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2 r17638
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

A rebel nation, born from civil war, has no capital city. If the rebels build
a new city, there is no Palace. (A new city normally gets a Palace unless the
player already has a capital.) The game seems to have confusion about whether
the rebels have a capital.

A search found bug #15548 (nation split off by civil war should get a
palace), but that bug is closed.

The problem might be in server/plrhand.c. I am using r17638 of S2_2 branch.

0 civil_war() calls split_player() to create the rebel player.
0 split_player() does 'cplayer->capital = TRUE', though the rebel player has
no cities and no capital.
0 civil_war() transfers some cities to the rebel player.
0 civil_war() calls city_build_free_buildings() with a random city to become
capital.
0 But city_build_free_buildings() from server/citytools.c does nothing
because pplayer->capital is true.

The confusion is that the rebel player has a true capital flag, but no city
is capital.

I first noticed this bug when I took control of a rebel player who had no
capital. I had no research. I needed Palace but did not know Masonry. I built
a new city, but there was no Palace. I found that capital flag was true inside
saved game. I was using old freeciv version, so I did not report bug.

After some hours, I have finally triggered a civil war with recent S2_2.
(Civil wars are not easy to trigger!) I have now verified that a rebel player
starts with no capital. Just open the attached x-civilwar-turn235, take Avram
Iancu of Romania (who split from Bulgaria) and see that Romania has no
Palace.



___

File Attachments:


---
Date: Monday 11/29/2010 at 21:16  Name: x-civilwar-turn201.sav.bz2  Size:
53kB   By: kernigh
at turn 235, rebel player Avram Iancu of Romania has no Palace

---
Date: Monday 11/29/2010 at 21:16  Name: x-civilwar-turn218.sav.bz2  Size:
55kB   By: kernigh
at turn 235, rebel player Avram Iancu of Romania has no Palace

---
Date: Monday 11/29/2010 at 21:16  Name: x-civilwar-turn235.sav.bz2  Size:
61kB   By: kernigh
at turn 235, rebel player Avram Iancu of Romania has no Palace


___

Reply to this item at:

  

___
  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 #16717] AI chooses new wonder city too often

2010-10-13 Thread George Koehler

Follow-up Comment #5, bug #16717 (project freeciv):

Uploading -v2 patches. They delete that FIXME comment, and also delete the
'redundant test?' comment, two lines down.

The test '!is_wonder(wonder_city->production.value.building)' is not
redundant, because city might build Barracks instead of wonder when AI has no
tech for wonder.

(file #10770, file #10771)
___

Additional Item Attachment:

File name: p22-keep-wonder-city-v2.diff   Size:0 KB
File name: ptrunk-keep-wonder-city-v2.diff Size:0 KB


___

Reply to this item at:

  

___
  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 #16851] use after free by diplomat_bribe()

2010-10-10 Thread George Koehler

URL:
  

 Summary: use after free by diplomat_bribe()
 Project: Freeciv
Submitted by: kernigh
Submitted on: Monday 10/11/2010 at 03:03
Category: None
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: trunk r18200
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

The trunk version of diplomat_bribe() continues to use struct unit *pvictim
after unit_change_owner() frees it.

Longturn players found this problem when LTeX, the Longturn experimental
game, crashed after they ported a feature from trunk to their server, which
is a variant of Freeciv 2.2.1. http://redmine.pagema.net/issues/237#note-23

Longturn admin Maho made a fix which prevents a failed assertion, but still
uses *pvictim after free. Longturn (with the fix) only crashes if I use
OpenBSD libc MALLOC_OPTIONS=J to fill the free memory with junk. Gna trunk
only crashes if I use MALLOC_OPTIONS=J.

I am attaching a slightly different fix (for Gna trunk) which does not crash
when I use MALLOC_OPTIONS=J. I am also attaching an example game where a
Diplomat can bribe a Galleon.



___

File Attachments:


---
Date: Monday 10/11/2010 at 03:03  Name: ptrunk-bribe-unit.diff  Size: 1kB  
By: kernigh
proposed fix; example game

---
Date: Monday 10/11/2010 at 03:03  Name: bribe-galleon-trunk.sav.bz2  Size:
11kB   By: kernigh
proposed fix; example game


___

Reply to this item at:

  

___
  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 #13557] [RT #40412] AI stops building wonders after game load

2010-10-07 Thread George Koehler

Follow-up Comment #5, bug #13557 (project freeciv):

Attaching
* x-reverse-ineq-turn75.sav.bz2, a game to reproduce this bug
* p22-aiwonder-v1.diff, a failed attempt to fix this bug

Load this game with S2_2, take human player Philippe le Hardi, click 'Turn
Done', then AIs stop building wonders.

Comment #2 showed that 'AI seems to immediately abandon its wonder city' by
choosing 'no city as wonder city'. Comment #3 showed that server/savegame.c
game_load_internal() calls ai/aicity.c ai_manage_buildings() which 'chooses
the wonder city'.

I can now explain _why_ it chooses no city. game_load_internal() calls
player_load_main() which calls ai_data_get() too early, before loading
cities. So ai_data_get() calculates that player has _zero_ cities on each
continent. Later ai_manage_buildings() requires more than _five_ cities on
the continent of the wonder city. It chooses no city because
(ai->stats.cities[place] > 5) is false.

My p22-aiwonder-v1.diff removes the early call to ai_data_get(). Now
ai->stats.cities[place] has correct value and ai_manage_buildings() can
choose a city. This is not a complete fix because there are two more
problems.

0 AI can choose a different city. World has changed during those turns after
the AI began to build a wonder, so ai_manage_buildings() can choose a
different city. Then AI abandons wonder at old city and starts wonder at new
city.
0 If AI chooses the same city, then this city changes to building Aqueduct
for one turn, then returns to building wonder.

To reproduce the second problem:

0 Apply p22-aiwonder-v1.diff to S2_2 server.
0 Load x-reverse-ineq-turn75.sav.bz2.
0 Know that AI Tancredo Neves of Brazil chooses Fortaleza as wonder city.
0 Take human player Philippe le Hardi of Burgundy.
0 '/obs Tan' to observe Brazil.
0 See that Fortaleza builds Great Library.
0 '/tak Phi' to play Burgundy.
0 Click 'Turn Done'.
0 Read 'The Brazilians have stopped building The Great Library(W) in
Fortaleza.'
0 '/obs Tan'
0 See that Fortaleza builds Aqueduct.
0 '/tak Phi'
0 Click 'Turn Done'.
0 Read 'The Brazilians have started building The Great Library(W) in
Fortaleza.'
0 '/obs Tan'
0 See that Fortaleza builds Great Library.

I might not find the answer for the Aqueduct problem, nor for the different
city problem.

(file #10658, file #10659)
___

Additional Item Attachment:

File name: p22-aiwonder-v1.diff   Size:2 KB
File name: x-reverse-ineq-turn75.sav.bz2  Size:28 KB


___

Reply to this item at:

  

___
  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 #16717] AI chooses new wonder city too often

2010-10-07 Thread George Koehler

Follow-up Comment #3, bug #16717 (project freeciv):

Attaching patches.
* p22-keep-wonder-city.diff for S2_2
* ptrunk-keep-wonder-city.diff for trunk

(file #10653, file #10654)
___

Additional Item Attachment:

File name: p22-keep-wonder-city.diff  Size:0 KB
File name: ptrunk-keep-wonder-city.diff   Size:0 KB


___

Reply to this item at:

  

___
  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 #13557] [RT #40412] AI stops building wonders after game load

2010-10-06 Thread George Koehler

Follow-up Comment #4, bug #13557 (project freeciv):

ai_manage_buildings() of ai/aicity.c is the function that chooses the wonder
city.



This is the server for Freeciv version 2.2.3+
You can learn a lot about Freeciv at http://www.freeciv.org/
2: Loading rulesets

Breakpoint 1, ai_manage_buildings (pplayer=0x1b06780) at
../../ai/aicity.c:1293
1293  struct ai_data *ai = ai_data_get(pplayer);
(gdb) print player_name(pplayer)
$1 = 0x1b06781 "Philippe le Hardi"
(gdb) bt
#0  ai_manage_buildings (pplayer=0x1b06780) at ../../ai/aicity.c:1293
#1  0x0187924c in game_load_internal (file=0xfffd8bf0)
at ../../server/savegame.c:5148
#2  0x01877bfc in game_load (file=0x1b06780) at ../../server/savegame.c:4218
#3  0x01812f64 in load_command (caller=0x20, filename=0xfffd8bf0 "(¬¥À", 
check=32) at ../../server/stdinhand.c:3355
#4  0x0180ae04 in srv_prepare () at ../../server/srv_main.c:2159
#5  0x0180b7c8 in srv_main () at ../../server/srv_main.c:2424
#6  0x01803b04 in main (argc=3, argv=0xfffdad74)
at ../../server/civserver.c:359
(gdb) cont
Continuing.
2: Philippe le Hardi choosing new wonder city (cause 1).
2: Philippe le Hardi chose no city as wonder city.

Breakpoint 1, ai_manage_buildings (pplayer=0x1b07368) at
../../ai/aicity.c:1293
1293  struct ai_data *ai = ai_data_get(pplayer);
(gdb) 



___

Reply to this item at:

  

___
  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 #16717] AI chooses new wonder city too often

2010-10-05 Thread George Koehler

Follow-up Comment #1, bug #16717 (project freeciv):

AI tries to pick a wonder city and build a wonder there. Today, the logic to
stay with a wonder city is broken, only because the code has '<=' instead of
'>=' at one place, so AI will never finish a wonder unless by luck AI chooses
this same city for every turn until this wonder is complete.

At ai_manage_buildings() under ai/aicity.c, I tried to change



from
0 <= wonder_city->surplus[O_SHIELD]

to
0 >= wonder_city->surplus[O_SHIELD]



and tried a game. I observed that the AI stayed with its wonder city, except
when this wonder city was not building a wonder (perhaps because the AI had
no technology for a wonder). So change from '<=' to '>=' seems to be good
idea.

I can create patch after I delete my logging code. I need to keep my logging
code while I study bug #13557.

___

Reply to this item at:

  

___
  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 #13557] [RT #40412] AI stops building wonders after game load

2010-10-05 Thread George Koehler

Follow-up Comment #3, bug #13557 (project freeciv):

As the server loads the saved game, the AI seems to immediately abandon its
wonder city.

I have a patch (file #10375 of bug #16717) that logs the choice of wonder
city. When I started my server:



This is the server for Freeciv version 2.2.3+
You can learn a lot about Freeciv at http://www.freeciv.org/
2: Loading rulesets
2: Philippe le Hardi choosing new wonder city (cause 1).
2: Philippe le Hardi chose no city as wonder city.
2: Ashoka choosing new wonder city (cause 1).
2: Ashoka chose no city as wonder city.
2: Tancredo Neves choosing new wonder city (cause 1).
2: Tancredo Neves chose no city as wonder city.
2: José Antonio Páez choosing new wonder city (cause 1).
2: José Antonio Páez chose no city as wonder city.
2: Kwanggaet'o choosing new wonder city (cause 1).
2: Kwanggaet'o chose no city as wonder city.
2: Now accepting new client connections.

For introductory help, type 'help'.
> 



AI would normally choose a city, but here, AI seems to be running without
knowledge of its own cities.

As soon as I start the game, AI chooses a wonder city for human players.



2: Connection request from kernigh from localhost
2: c1 has client version 2.2.3+
> 
Starting game.
Player 'Ashoka' now has AI skill level 'Easy'.
Player 'Tancredo Neves' now has AI skill level 'Easy'.
Player 'José Antonio Páez' now has AI skill level 'Easy'.
Player 'Kwanggaet'o' now has AI skill level 'Easy'.
2: Philippe le Hardi choosing new wonder city (cause 1).
2: Philippe le Hardi chose Dijon as wonder city.



After I click 'Turn Done', AI chooses a wonder city for AI players. (Human
player Philippe le Hardi keeps Dijon, but only because I am testing a fix to
bug #16717.)



> 
2: Kwanggaet'o choosing new wonder city (cause 1).
2: Kwanggaet'o chose Ungjin as wonder city.
2: José Antonio Páez choosing new wonder city (cause 1).
2: José Antonio Páez chose Trujillo as wonder city.
2: Ashoka choosing new wonder city (cause 1).
2: Ashoka chose Madurai as wonder city.
2: Tancredo Neves choosing new wonder city (cause 1).
2: Tancredo Neves chose Fortaleza as wonder city.
Game saved as /home/kernigh/.freeciv/saves/freeciv-T0076-Y-0600-auto.sav.bz2
>



At the same time, the game also announces that the AI players abandoned their
wonders:

* The Venezuelans have stopped building The Great Library(W) in Zulia.
* The Indians have stopped building The Great Library(W) in Calcutta.
* The Brazilians have stopped building The Great Library(W) in Fortaleza.

Brazil chooses Fortaleza as wonder city, but does not continue a wonder
there, perhaps because Brazil had no wonder city at the end of the previous
turn.

___

Reply to this item at:

  

___
  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 #16751] Joining "localhost" fails when IPv6 is disabled

2010-09-25 Thread George Koehler

Follow-up Comment #5, bug #16751 (project freeciv):

> I'd say that bug is not in Freeciv, but in the fact that /etc/hosts makes
"localhost" to resolve as "::1" even though IPv6 is disabled in the system.

I guess that this is bug in Freeciv. You can have "localhost" resolve to
"::1", whether IPv6 is enabled or disabled.

In general, names can resolve to IPv6 addresses, whether or not the machine
has IPv6. For example, I have IPv4-only access to internet, but DNS assigns
IPv6 addresses to many names. I am not required to change the entire internet
DNS to remove all IPv6 addresses. For example,



~ $ host www.kame.net
www.kame.net is an alias for orange.kame.net.
orange.kame.net has address 203.178.141.194
orange.kame.net has IPv6 address 2001:200:dff:fff1:216:3eff:feb1:44d7



I can visit http://www.kame.net by its IPv4 address, without removing its
IPv6 address from DNS.

The bug in Freeciv might (or might not) be here in client/clinet.c:



  if (!net_lookup_service(hostname, port, &server_addr, FALSE)) {
(void) mystrlcpy(errbuf, _("Failed looking up host."), errbufsize);
return -1;
  }



But if hostname has IPv6 address, and net_lookup_service() 4th argument is
FALSE, then this will only find the IPv6 address, never the IPv4 address.
This is broken, because clients on IPv4-only connections cannot connect to a
server that has both IPv4 and IPv6 in DNS.

My patch for bug #15559 changes client/clinet.c:



  if (!net_lookup_service(hostname, port, &names[0], FALSE)) {
(void) mystrlcpy(errbuf, _("Failed looking up host."), errbufsize);
return -1;
  }
  name_count = 1;
#ifdef IPV6_SUPPORT
  if (names[0].saddr.sa_family == AF_INET6) {
/* net_lookup_service() prefers IPv6 address.
 * Check if there is also IPv4 address.
 * TODO: This would be easier using getaddrinfo() */
if (net_lookup_service(hostname, port,
   &names[1], TRUE /* force IPv4 */)) {
  name_count = 2;
}
  }
#endif



So it finds both IPv4 and IPv6 addresses. This was part of my attempt to fix
bug #15559 (Client can't connect to its locally started server). This allowed
my client to reach an IPv4-only server (./ser -b 0.0.0.0) at "localhost".

I suspect that the original submitter has Linux kernel without AF_INET6.
Freeciv server handles EAFNOSUPPORT from socket() and switches to IPv4.
Freeciv client fails to connect to ::1 but also fails to switch to 127.0.0.1.

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-09-25 Thread George Koehler

Follow-up Comment #32, bug #15559 (project freeciv):

This is v7 patch.

Because I am author of v1 thru v5, I decided to try v7. The only changes from
v6 to v7 are in server_open_socket() of server/sernet.c, where I tried to add
the recent ideas from comment #27 to comment #31.

(file #10446, file #10447)
___

Additional Item Attachment:

File name: p22-plural-listen-v7.diff  Size:17 KB
File name: ptrunk-plural-listen-v7.diff   Size:18 KB


___

Reply to this item at:

  

___
  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 #16509] Blank hostname

2010-09-22 Thread George Koehler

Follow-up Comment #5, bug #16509 (project freeciv):

I found an Ubuntu getnameinfo(3) at
http://manpages.ubuntu.com/manpages/maverick/en/man3/getnameinfo.3.html

Further down, it says:



NI_NUMERICHOST
  If  set,  then  the  numeric  form  of the hostname is
returned.
  (When not set, this will still happen in case  the  node's 
name
  cannot be determined.)



If the manual page is correct, then Ubuntu getnameinfo() returns the
numerical address if there is no name. So NI_NAMEREQD would not fix this bug,
because getnameinfo() provides a numerical address, not an empty string.

There is no harm to add NI_NAMEREQD to the code, whether or not it fixes this
bug.

> Do you have an other idea how a connection can get an empty hostname?

* A pointer bug, that drops the name in the wrong buffer?
* A buffer size that is too small? (But this would probably cause a truncated
name instead of an empty name.)
* A bad DNS server that provides "" as name for some address?

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-09-21 Thread George Koehler

Follow-up Comment #30, bug #15559 (project freeciv):

>From x11_create_display_inet() of openssh-5.6p1/channels.c:



for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family != AF_INET && ai->ai_family != 
AF_INET6)
continue;
sock = socket(ai->ai_family, ai->ai_socktype,
ai->ai_protocol);
if (sock < 0) {
if ((errno != EINVAL) && (errno != EAFNOSUPPORT)
#ifdef EPFNOSUPPORT
&& (errno != EPFNOSUPPORT)
#endif 
) {
error("socket: %.100s", 
strerror(errno));
freeaddrinfo(aitop);
return -1;
} else {
debug("x11_create_display_inet: Socket 
family %d not supported",
 ai->ai_family);
continue;
}
}
if (ai->ai_family == AF_INET6)
sock_set_v6only(sock);
if (x11_use_localhost)
channel_set_reuseaddr(sock);
if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
debug2("bind port %d: %.100s", port, 
strerror(errno));
close(sock);

for (n = 0; n < num_socks; n++) {
close(socks[n]);
}
num_socks = 0;
break;
}
socks[num_socks++] = sock;
if (num_socks == NUM_SOCKS)
break;
}



During X11 forwarding, if any bind() fails, then OpenSSH loops to close _all_
sockets.

This only happens during X11 forwarding! Other code at
channel_setup_fwd_listener() from channels.c, and at server_listen() from
sshd.c, seems to allow bind() to fail.



>From openssh-5.6p1/misc.c:



void
sock_set_v6only(int s)
{
#ifdef IPV6_V6ONLY
int on = 1;

debug3("%s: set socket %d IPV6_V6ONLY", __func__, s);
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1)
error("setsockopt IPV6_V6ONLY: %s", strerror(errno));
#endif
}




___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-09-20 Thread George Koehler

Follow-up Comment #28, bug #15559 (project freeciv):

>> "IPv4 bind failed: Address already in use"
> Print that particular error message only if also IPv6 bind failed?

To be exact, print no error messages if we can listen() to at least one
socket?

OpenBSD 'man getaddrinfo' shows an example of this:



   for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
   s[nsock] = socket(res->ai_family, res->ai_socktype,
   res->ai_protocol);
   if (s[nsock] == -1) {
   cause = "socket";
   continue;
   }

   if (bind(s[nsock], res->ai_addr, res->ai_addrlen) == -1)
{
   cause = "bind";
   save_errno = errno;
   close(s[nsock]);
   errno = save_errno;
   continue;
   }
   (void) listen(s[nsock], 5);

   nsock++;
   }
   if (nsock == 0)
   err(1, "%s", cause);



Other programs had no 'cause' variable and no 'save_errno' stuff around
close(), but they kept the idea to ignore errors if they listen() to at least
one socket.

The old Freeciv code printed every error that happens. When I made the
plural-listen patch, I tried to preserve the old code, so it alarmingly
prints every error that happens!

So someone must decide whether to print no error messages if Freeciv can
listen() to at least one socket.

___

Reply to this item at:

  

___
  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 #16717] AI chooses new wonder city too often

2010-09-16 Thread George Koehler

URL:
  

 Summary: AI chooses new wonder city too often
 Project: Freeciv
Submitted by: kernigh
Submitted on: Thursday 09/16/2010 at 23:52
Category: ai
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_2
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

If the wonder city has +0 or more shield surplus (which is almost always
true), then AI will choose a wonder city. If it chooses a different city then
it stops building the wonder.

The cause is the inequality '0 <= wonder_city->surplus[O_SHIELD]' in
ai_manage_buildings() under ai/aicity.c. This inequality is almost always
true, so AI enters the code to choose a wonder city at almost every turn.
Unless AI chooses the same city, AI stops building the wonder.

I found the inequality while hunting for the cause of bug #13557 (AI stops
building wonders after game load), but this seems to be a different bug. The
inequality seems to be the reverse of the intended '0 >=
wonder_city->surplus[O_SHIELD]' or 'wonder_city->surplus[O_SHIELD] <= 0'.



I hacked my S2_2 server to log about AI wonder cities
(p22-log-ai-wonder-city.diff). I then started a game.

Glaukias of the Illyrians (an easy AI) chose Onchesmos as wonder city.
Onchesmos started building Pyramids. For several turns, Glaukias rejected
Onchesmos (because 0 <= shield surplus) but chose Onchesmos again.

At 1600 BC (T48), Glaukias chose Antigonea instead of Onchesmos. So Onchesmos
stopped building Pyramids and diverted its 52 shields to Settlers
(aiwonder-turn48.sav.bz2).



___

File Attachments:


---
Date: Thursday 09/16/2010 at 23:52  Name: p22-log-ai-wonder-city.diff  Size:
3kB   By: kernigh
not a bug fix!

---
Date: Thursday 09/16/2010 at 23:52  Name: aiwonder-turn48.sav.bz2  Size: 20kB
  By: kernigh
not a bug fix!


___

Reply to this item at:

  

___
  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 #16623] netintf.c gcc warnings in net_lookup_service

2010-09-14 Thread George Koehler

Follow-up Comment #4, bug #16623 (project freeciv):

I made a patch that replaces gethostbyname2() with getaddrinfo().

However, I run OpenBSD, so I cannot determine if this patch fixes this bug
with Microsoft Windows. (I have a different reason to use getaddrinfo(): it
helps fe80::/64 link-local addresses.)

Can the original poster, or anyone with similar Windows system, try this
patch?



Freeciv uses net_lookup_service() of netintf.c to get socket addresses. With
this patch, net_lookup_service() uses getaddrinfo() for IPv6 addresses, and
uses inet_aton() or gethostbyname() for IPv4 addresses.

My idea from comment #3, about replacing 'the multiple calls to
net_lookup_service() with a single call to getaddrinfo()', would require much
more refactoring of Freeciv code.

(file #10345, file #10346)
___

Additional Item Attachment:

File name: p22-getaddrinfo.diff   Size:3 KB
File name: ptrunk-getaddrinfo.diffSize:3 KB


___

Reply to this item at:

  

___
  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 #16509] Blank hostname

2010-09-13 Thread George Koehler

Follow-up Comment #3, bug #16509 (project freeciv):

I believe that file #10015, which adds NI_NAMEREQD to getnameinfo(), would
not fix this bug.

>From OpenBSD 'man getnameinfo':



 NI_NAMEREQD   A name is required.  If the host name cannot be found
   in DNS and this flag is set, a non-zero error code is
   returned.  If the host name is not found and the flag
   is not set, the address is returned in numeric form.



If there is no host name, getnameinfo() provides a numeric address. With
NI_NAMEREQD, getnameinfo() would fail. When it fails, Freeciv uses the
numeric adddress from the earlier call to inet_ntop(). The entire effect of
file #10015 would be to use the numeric address instead of the numeric
address.

We can use NI_NAMEREQD because there is no reason to get the numeric address
again; but NI_NAMEREQD would not solve this bug. Or would it?

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-09-10 Thread George Koehler

Follow-up Comment #26, bug #15559 (project freeciv):

I switched from my v5 patch and applied the v6 patch by Jtn. (I also use my
own patch from bug #16458, because that bug blocks configure enabling IPv6.)
I confirm that p22-plural-listen-v6.diff and ptrunk-plural-listen-v6.diff
work with my OpenBSD system.

We think that the patch works with OpenBSD and with Linux, but the other
platforms are a mystery.



I also tried building S2_2 with --disable-ipv6. I confirm that
p22-plural-listen-v6.diff does not break a --disable-ipv6 build.



The original bug, as I understand it, is that the client fails to connect to
its own server if _both_ of the following are true:

0 Socket option IPV6_V6ONLY defaults to on (like *BSD with
net.inet6.ip6.v6only=1 or Linux with net.ipv6.bindv6only=1).
0 "localhost" resolves to 127.0.0.1 but not ::1.

To reproduce the original bug, you want to "sysctl -w net.ipv6.bindv6only=1"
(or equivalent) _and_ you want to kill the /etc/hosts line "::1 localhost"
(or equivalent). Then the server socket will accept only IPv6 connections,
and the client will fail to make an IPv4 connection to "localhost".



To use a link-local address from fe80::/64, you _must_ set a a scope (the
'sin6_scope_id' field of 'struct sockaddr_in6'). BSD getaddrinfo() understand
the syntax 'fe80::numbers%interface', where the network interface is the
scope.

For example, here is my Ethernet interface (with an edited address):


$ ifconfig gem0
gem0: ...
lladdr 00:12:34:89:ab:cd
inet6 fe80::212:34ff:fe89:abcd%gem0 prefixlen 64 scopeid 

If I say 'ping6 fe80::212:34ff:fe89:abcd%gem0' then it works, but if I say
'ping6 fe80::212:34ff:fe89:abcd' (without the '%gem0') then it fails.


$ ./ser -b fe80::20d:93ff:fe2d:f3fa%gem0 
This is the server for Freeciv version 2.2.2+
You can learn a lot about Freeciv at http://www.freeciv.org/
0: Server: bad address: .


This is probably because Freeciv uses gethostbyname2() instead of
getaddrinfo(); see bug #16623.



The older versions of the patch, v1 through v4, added this extra code to
server_open_socket(), where opt = 1:


#if defined(IPV6_SUPPORT) && defined(IPV6_V6ONLY)
if (names[i].saddr.sa_family == AF_INET6) {
  setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
 (char *)&opt, sizeof(opt));
}
#endif


I deleted this code from v5, because I was uncertain about whether to include
or exclude this code. I guess that this code is not necessary to fix this
bug.

If freeciv-server says "IPv4 bind failed: Address already in use", then its
IPv6 socket might accept IPv4 connections. This is not ideal, because
messages will refer to addresses like ":::192.168.0.56" instead of
"192.168.0.56".

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-09-08 Thread George Koehler

Follow-up Comment #18, bug #15559 (project freeciv):

I changed the error code in server/sernet.c to try to identify the socket
that causes the error. I also remade the trunk patch, so now trunk seems to
work.

This is the *last* version of the patch from me, unless I discover that I
made some mistake.

* p22-plural-listen-v5.diff for S2_2 r17952
* ptrunk-plural-listen-v5.diff for trunk r17952

(file #10258, file #10259)
___

Additional Item Attachment:

File name: p22-plural-listen-v5.diff  Size:16 KB
File name: ptrunk-plural-listen-v5.diff   Size:17 KB


___

Reply to this item at:

  

___
  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 #16623] netintf.c gcc warnings in net_lookup_service

2010-09-05 Thread George Koehler

Follow-up Comment #3, bug #16623 (project freeciv):

I found the reference. [url=http://tools.ietf.org/html/rfc3493]RFC
3493[/url], which defines IPv6 sockets, explains that 'The gethostbyname2()
function was deprecated in RFC 2553 and is no longer part of the basic API.'

I suppose that someone deleted gethostbyname2() from , but left
gethostbyname2() in the library for backward compatibility with old programs.
Then the replacement of gethostbyname2() with getaddrinfo() might fix this
bug.



net_lookup_service() returns only one address, but getaddrinfo() returns a
linked list of addresses. I designed my patch for bug #15559 to use multiple
calls to net_lookup_service() to build an array of addresses. My idea is that
someone will replace the multiple calls to net_lookup_service() with a single
call to getaddrinfo().

___

Reply to this item at:

  

___
  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 #16596] Mark capital cities on map

2010-09-03 Thread George Koehler

Follow-up Comment #1, bug #16596 (project freeciv):

The diplomacy dialog requires embassy or contact. If your embassy status is
'No Contact', then there is no diplomacy report and you need to middle-click
cities. (This often happens where contactturns=0.)

For a capital city, one might underline the city name, or change the text
color.

___

Reply to this item at:

  

___
  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 #16623] netintf.c gcc warnings in net_lookup_service

2010-09-03 Thread George Koehler

Follow-up Comment #1, bug #16623 (project freeciv):

I guess that your libraries define gethostbyname2() but your header files
fail to declare gethostbyname2(). Perhaps your  file is too old? The
configure script only checks for gethostbyname2() in the libraries, not the
header files. Freeciv only uses gethostbyname2() if the check passes.

The warning is serious. The compiler needs a declaration to know that
gethostbyname2() returns a pointer, not an int.

As a workaround, you might configure with --disable-ipv6 to disable the code
that uses gethostbyname2().

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-09-03 Thread George Koehler

Follow-up Comment #17, bug #15559 (project freeciv):

I made a trunk version of the patch, but it is broken. The client complains
about unknown error 0 and the server says '2: Lost connection: c1 from
localhost (connection incomplete).' I might have made a mistake in
client/clinet.c; I need more time to find the mistake and post a working
patch.

I am attaching a broken patch for trunk r17924.

The S2_2 version (file #10046) continues to work for me. This week, I played
at least 200 turns of S2_2.

(file #10146)
___

Additional Item Attachment:

File name: ptrunk-plural-listen-broken.diff Size:17 KB


___

Reply to this item at:

  

___
  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] [patch #1860] require gcc 3.4 for __attribute__((warn_unused_result))

2010-08-28 Thread George Koehler

Follow-up Comment #2, patch #1860 (project freeciv):

Attaching patch for trunk r17877

(file #10053)
___

Additional Item Attachment:

File name: ptrunk-less-warnings-v2.diff   Size:2 KB


___

Reply to this item at:

  

___
  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 #16567] modinst/download.c fails to compile

2010-08-28 Thread George Koehler

URL:
  

 Summary: modinst/download.c fails to compile
 Project: Freeciv
Submitted by: kernigh
Submitted on: Saturday 08/28/2010 at 17:33
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: trunk
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

modinst/download.c of trunk r17877 fails to compile:

In file included from ../../modinst/download.c:19:
/usr/include/sys/socket.h:148: error: syntax error before "u_int8_t"
/usr/include/sys/socket.h:166: error: syntax error before "u_int8_t"
/usr/include/sys/socket.h:169: error: syntax error before "u_int64_t"
/usr/include/sys/socket.h:235: error: syntax error before "uid_t"
/usr/include/sys/socket.h:240: error: syntax error before "gid_t"
/usr/include/sys/socket.h:368: error: syntax error before "socklen_t"
...

This is like bug #16458; my OpenBSD system requires programs to include
 before . I attach diff to add  to
modinst/download.c.

(Other files, like utility/netintf.c, escape the error only because they
include  or  before . Both of these
headers seem to suck in .)



___

File Attachments:


---
Date: Saturday 08/28/2010 at 17:33  Name: ptrunk-types-before-socket.diff 
Size: 337B   By: kernigh
patch to modinst/download.c (trunk)


___

Reply to this item at:

  

___
  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 #16556] Mac compatibility of the flag convert script

2010-08-28 Thread George Koehler

Follow-up Comment #4, bug #16556 (project freeciv):

I run an old version of OpenBSD; I have the same problem with OpenBSD 'sed'.

$ echo EXAMPLE.SVG | sed 's/.svg$//i'
sed: 1: "s/.svg$//i": bad flag in substitute command: 'i'

$ echo EXAMPLE.SVG | sed 's/.[Ss][Vv][Gg]$//'
EXAMPLE

I never encountered this bug because I never use the convert_png script.

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-08-28 Thread George Koehler

Follow-up Comment #16, bug #15559 (project freeciv):

gcc gives the same warning to me. gcc notices that if name_count <= 0, then
we never enter the for loop to initialize 'sock'.

I am attaching a -v4 patch that prevents the warning. The patch is for S2_2.

I have never used trunk. I am now trying to compile trunk so that I can port
the patch.

(file #10046)
___

Additional Item Attachment:

File name: p22-plural-listen-v4.diff  Size:15 KB


___

Reply to this item at:

  

___
  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 #16506] Non-military units belonging to a class without the ZOC class flag have a ZOC

2010-08-21 Thread George Koehler

Follow-up Comment #6, bug #16506 (project freeciv):

The default units.ruleset explains "ZOC" unit class flag:


; "ZOC"   = Unit is subject to ZOC rules. Unit type flag "IgZOC" can
;   override this


And "IgZOC" unit flag:


; "IgZOC"   = ignore Zones of Control (ZOC) even if unit class has "ZOC"
flag


ChangeLog has:


Added unit class flag "ZOC" for units that are subject to Zone Of Control
rules. Previously this was hardcoded to LAND_MOVING. Unit type flag "IgZOC"
may override this.


> Yet i can clearly recall times when an enemy Explorer has blocked movement
of my Warriors.

This is correct. Explorers have "ZOC" and "IgZOC" under the default ruleset.
Explorers can impose zones of control, but Explorers ignore zones of control
imposed by other units.

Under the custom ruleset by Anonymous, Explorers should not impose zones of
control.

> It turns out that "NonMil" merely means a unit doesn't acquire veteranship
the normal way.

"NonMil" units will not impose martial law and will not cause unhappiness.
"NonMil" units can acquire veteranship by the normal way
(veteran_raise_chance, veteran_work_raise_chance and "Veteran_Build").

___

Reply to this item at:

  

___
  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 #16491] assertion fails in make_contact(), after using editor

2010-08-20 Thread George Koehler

Follow-up Comment #3, bug #16491 (project freeciv):

Your patch (file #9933) fixes the map editor. I watched as the AI players
killed most of the Prussian Warriors, without crashing the server.

I will discuss the Longturn bug at its page. You found the page at
http://redmine.pagema.net/issues/96

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-08-20 Thread George Koehler

Follow-up Comment #13, bug #15559 (project freeciv):

My -v2 patch (from S2_2 r17797) causes a merge conflict in server/sernet.c. I
am attaching a new -v3 patch (from S2_2 r17820) to solve the conflict.

If you already applied the -v2 patch, you might

$ patch -R < p22-plural-listen-v2.diff
$ svn up
$ patch < p22-plural-listen-v3.diff

or you might

$ svn up
$ svn revert server/sernet.c server/meta.c client/clinet.c client.servers.c
$ patch < p22-plural-listen-v3.diff

(file #9941)
___

Additional Item Attachment:

File name: p22-plural-listen-v3.diff  Size:15 KB


___

Reply to this item at:

  

___
  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 #16491] assertion fails in make_contact(), after using editor

2010-08-19 Thread George Koehler

URL:
  

 Summary: assertion fails in make_contact(), after using
editor
 Project: Freeciv
Submitted by: kernigh
Submitted on: Friday 08/20/2010 at 00:36
Category: editor
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_2
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:


> assertion "pplayer_get_diplstate(pplayer2, pplayer1)->type !=
DS_NO_CONTACT" failed: file "../../server/plrhand.c", line 1169, function
"make_contact"
Abort trap (core dumped)


I am running S2_2 r17795.

This sometimes happens after using the editor to remove a player and then
create a new player (in the same slot). The new player inherits some
diplomacy stuff (like embassies) from the old player. This seems to create an
inconsistency where the new player has "never met" the other players, but the
other players have already met the new player. This inconsistency can abort
the server in make_contact() at plrhand.c:1169.

Steps to reproduce:
0 Load attached game *fall-of-armenia-turn246.sav.bz2*.
0 Take Armenians, start game.
0 Disband last unit in last city.
0 Click "Turn Done". RIP Armenia.
0 Enable the editing mode.
0 Switch from Armenia to "Global Observer".
0 Open dialog to edit players.
0 Destroy Armenia.
0 Create new player. (I will call Prussia.)
0 Close dialog.
0 Select new unit, Warriors, Prussia.
0 Place some Prussian Warriors, near but not adjacent to existing cities and
warriors.
0 Switch from "Global Observer" to Prussia.
0 Disable the editing mode.
0 Click "Turn Done". Assertion fails, server aborts.

The other attached game *rise-of-prussia-turn247.sav.bz2* is from after
placing those Prussian Warriors but before clicking "Turn Done".

This bug is similar to bug #96  of
Longturn , where the same assertion fails. The
difference is that I am now crashing the vanilla S2_2 server instead of the
modified Longturn server, by using the map editor instead of LTeX newcomers.



___

File Attachments:


---
Date: Friday 08/20/2010 at 00:36  Name: fall-of-armenia-turn246.sav.bz2 
Size: 56kB   By: kernigh
save files from before and after usage of editor

---
Date: Friday 08/20/2010 at 00:36  Name: rise-of-prussia-turn247.sav.bz2 
Size: 54kB   By: kernigh
save files from before and after usage of editor


___

Reply to this item at:

  

___
  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 #16480] Usability of Help button on research window

2010-08-18 Thread George Koehler

Follow-up Comment #5, bug #16480 (project freeciv):

I use the Help checkbox. I have never tried right-clicking the tech tree.

I remember an old version of Freeciv, before they added the tech tree. The ui
only had the dropdown menus and the Help checkbox, so the dropdown menus were
the obvious place to look for help.

___

Reply to this item at:

  

___
  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 #16476] Client freezes trying to connect to its own server (ipv6)

2010-08-18 Thread George Koehler

Follow-up Comment #1, bug #16476 (project freeciv):

Can you try my patch, file #9918 from bug #15559? My patch should cause that
Freeciv try both IPv4 and IPv6. So my patch might or might not fix your bug.

To apply the patch:

$ cd your-freeciv-2.2-checkout
$ patch < file-9918.diff

Then compile Freeciv with --enable-ipv6.

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-08-18 Thread George Koehler

Follow-up Comment #11, bug #15559 (project freeciv):

Here is my second attempt *p22-plural-listen-v2.diff*

This patch uses net_lookup_service() to get both IPv4 and IPv6 addresses. The
server listens to all addresses, using an array 'listen_socks'. The client
tries all addresses, and uses the first address to work.

* If your system enables IPV6_V6ONLY by default (like *BSD with
net.inet6.ip6.v6only=0 or Linux with net.ipv6.bindv6only=0), then this patch
should allow your freeciv-server to accept both IPv6 and IPv4 connections.
* If your /etc/hosts defines "localhost" as both 127.0.0.1 and ::1, or only
127.0.0.1, or only ::1, then this patch should allow your Freeciv client to
connect to its locally started server.

Patch is for S2_2. Please test patch.

(file #9918)
___

Additional Item Attachment:

File name: p22-plural-listen-v2.diff  Size:15 KB


___

Reply to this item at:

  

___
  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] [patch #1860] require gcc 3.4 for __attribute__((warn_unused_result))

2010-08-18 Thread George Koehler

Follow-up Comment #1, patch #1860 (project freeciv):

I forgot the warning from server/notify.h; here is a new version that patches
utility/support.h, utility/mem.h and server/notify.h.

Patch for S2_2.

(file #9917)
___

Additional Item Attachment:

File name: p22-less-warnings-v2.diff  Size:2 KB


___

Reply to this item at:

  

___
  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 #16461] server can exceed MAX_NUM_CONNECTIONS and leak sockets

2010-08-17 Thread George Koehler

Follow-up Comment #4, bug #16461 (project freeciv):

Your file #9893 fixes the bug of S2_2; I can no longer reproduce the bug. The
65th client now says 'Lost connection to server!'.

___

Reply to this item at:

  

___
  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 #16469] Freecivic 2.2.2 crashes >AD500

2010-08-17 Thread George Koehler

Follow-up Comment #5, bug #16469 (project freeciv):

Some computers put the savegames in ~/.freeciv/saves (the 'saves' directory
inside the invisible '.freeciv' directory inside your home directory).

A savegame named 'freeciv-T0001-Y-3950-auto' will have a file named like
'freeciv-T0001-Y-3950-auto.sav.bz2'. You might search your computer for such
files.

___

Reply to this item at:

  

___
  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 #16442] Great Library should take in account teams, not players

2010-08-16 Thread George Koehler

Follow-up Comment #5, bug #16442 (project freeciv):

Notice that file #9848, the S2_2 fix for bug #16442 (Great Library), also
includes the fix for bug #16437 (voting bar). Apply one fix, get one fix
free!

___

Reply to this item at:

  

___
  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] [patch #1860] require gcc 3.4 for __attribute__((warn_unused_result))

2010-08-16 Thread George Koehler

URL:
  

 Summary: require gcc 3.4 for
__attribute__((warn_unused_result))
 Project: Freeciv
Submitted by: kernigh
Submitted on: Tuesday 08/17/2010 at 01:36
Category: general
Priority: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 

___

Details:

I have been compiling Freeciv with the gcc 3.3.5 (propolice) that comes with
OpenBSD. This version does not support __attribute__((warn_unused_result)),
so gcc emits a warning at every instance of warn_unused_result. I see about
four warnings per .c file.

Documentation says that gcc 3.4 has warn_unused_result
 but
gcc 3.3 lacks it
.

This patch to utility/support.h and utility/mem.h checks for gcc 3.4 and
defines and uses fc__warn_unused_result.

This patch is for S2_2.



___

File Attachments:


---
Date: Tuesday 08/17/2010 at 01:36  Name: p22-less-warnings.diff  Size: 2kB  
By: kernigh
patch to utility/{support,mem}.h (S2_2)


___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-08-16 Thread George Koehler

Follow-up Comment #10, bug #15559 (project freeciv):

AF_INET6 configure check is now bug #16458.

Failure to close extra connections is now bug #16461. (I was wrong. This is
not a new bug, because one socket is already enough to accept too many
connections. I was idiot and forgot to read my listen(2) manual page.)

So this bug, bug #15559, is now only about fixing the IPV6_SUPPORT code. I am
working on the next version of the patch; file #9838 is not complete because
it fixed the server but not the client. The server must try to listen to both
IPv4 and IPv6; the client must try to connect to either IPv4 or IPv6.

___

Reply to this item at:

  

___
  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 #16461] server can exceed MAX_NUM_CONNECTIONS and leak sockets

2010-08-16 Thread George Koehler

URL:
  

 Summary: server can exceed MAX_NUM_CONNECTIONS and leak
sockets
 Project: Freeciv
Submitted by: kernigh
Submitted on: Tuesday 08/17/2010 at 00:02
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_2
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

If too many clients connect to the server, then the server accepts the extra
connections, then does nothing with the extra sockets.

MAX_NUM_CONNECTIONS is now 64. To reproduce this bug without opening 64
clients, use a script (like this Ruby line) to create 64 connections:


ruby -rsocket -e '64.times { TCPSocket.new("localhost", 5556) }; gets'


Then open Freeciv client and make 65th connection. Server will log this:


1: maximum number of connections reached
1: failed accepting connection
>


The server never closes the 65th socket, so the client waits forever.

After hundreds of connections, the server reaches a process limit and repeats
this message to infinity:


1: accept failed: Too many open files
1: failed accepting connection
> 


One must understand that 'listen(socket, MAX_NUM_CONNECTIONS)' allows a
backlog of 64 connections. After the server accepts 64 connections, the
backlog is empty and the server can accept more connections.

To fix this bug, server_make_connection() in server/sernet.c might need to
close the extra socket (after perhaps sending an error to the client).




___

Reply to this item at:

  

___
  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 #16454] suggestion about citymindist - only consider same team in calculation

2010-08-16 Thread George Koehler

Follow-up Comment #1, bug #16454 (project freeciv):

If citymindist acts as you suggest:

0 You can break alliance, build city too close, then rejoin alliance.
0 You can build city too close (at distance 1) to enemy city.

To reduce frustration with citymindist=4, you might want to try fogofwar=0.

___

Reply to this item at:

  

___
  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 #16458] configure fails to find AF_INET6 of OpenBSD

2010-08-16 Thread George Koehler

URL:
  

 Summary: configure fails to find AF_INET6 of OpenBSD
 Project: Freeciv
Submitted by: kernigh
Submitted on: Monday 08/16/2010 at 21:49
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_2
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

OpenBSD has AF_INET6, but _configure_ fails to find it. The check for
AF_INET6 fails because it forgot to include  before
. This is necessary because  defines types like
'u_int8_t' which appear in .

I attach a patch for S2_2 to configure.ac; this allows _configure_ to detect
AF_INET6 and enable IPv6 support above OpenBSD.

(Note that IPv6 support inside Freeciv is buggy because of bug #15559. If
this patch goes in, some users may want to configure --disable-ipv6 until bug
#15559 has a fix.)



___

File Attachments:


---
Date: Monday 08/16/2010 at 21:49  Name: p22-confinet6.diff  Size: 621B   By:
kernigh
patch to configure.ac (S2_2)


___

Reply to this item at:

  

___
  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 #16448] freeciv.org contact addresses bouncing

2010-08-16 Thread George Koehler

Follow-up Comment #1, bug #16448 (project freeciv):

If these email addresses accepted mail, then users would can send email to
ask for fix to bug #16338 (DNS problems with freeciv.org).

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-08-15 Thread George Koehler

Follow-up Comment #8, bug #15559 (project freeciv):

While I am using my patch (file #9838),
'./ser --bind ::' starts an IPv6-only server,
'./ser --bind 0.0.0.0' starts an IPv4-only server.

If I run IPv4-only server, then my Freeciv client can connect to '127.0.0.1'
but refuses to connect to 'localhost'. This problem is with the client, not
the server. If I run 'nc localhost 5556' then I can connect to either the
IPv6-only server or the IPv4-only server.

So file #9838 is not enough to fix the broken IPV6_SUPPORT; the Freeciv
client also needs a fix.

___

Reply to this item at:

  

___
  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 #16419] Server will not start and cannot start new game

2010-08-14 Thread George Koehler

Follow-up Comment #3, bug #16419 (project freeciv):

This might be the same bug as bug #15559, but only if IPv6 causes this bug.

___

Reply to this item at:

  

___
  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 #15559] Client can't connect to its locally started server

2010-08-14 Thread George Koehler

Follow-up Comment #7, bug #15559 (project freeciv):

I have a similar bug using OpenBSD. I am running an old snapshot of OpenBSD
4.5-current.

My server (S2_2 r17748) accepted connections from "localhost" and from
"127.0.0.1", but not from "::1". I found that my server had no IPv6 support,
because configure failed the AF_INET6 check. OpenBSD has AF_INET6, so I fixed
configure and rebuilt my server with IPv6 support.

Now my server, with IPv6 support, accepts connections from "localhost" and
"::1", but not from "127.0.0.1". My server refuses IPv4 connections because
it listens only to IPv6 socket.

* RFC 3493  specifies that IPv6 socket
may use IPv4 with addresses like ":::172.34.5.6".
* Some systems (at least OpenBSD) require IPv6 sockets to use IPv6 only. This
has security reason: "IPv4-Mapped Addresses on the Wire Considered Harmful"
.
* I have rumours that some versions of Debian, FreeBSD, NetBSD and Microsoft
Windows enable IPV6_V6ONLY by default.
* OpenBSD provides zero ways to disable IPV6_V6ONLY.
* Opinions from internet do range from 'IPV6_V6ONLY on is stupid' to
'IPV6_V6ONLY off is stupid'.

The correct way is to listen to multiple sockets: both IPv4 socket and IPv6
socket. Examples are identd.c
 and
sshd.c  of
OpenBSD. They use getaddrinfo(3) to get list addresses, create one socket(2)
per address, then poll(2) multiple sockets to listen(2).

I am attaching a patch *p22-listen-plural.diff* for S2_2 that attempts to use
multiple sockets. This might fix bug #15559 and bug #16149.

0 This patch fixes the AF_INET6 configure check. (OpenBSD needs 
before .)
0 This patch replaces the one socket 'sock' with an array 'listen_socks', and
listens to all connections in the array.
0 This patch adds a new bug. The multiple sockets can accept too many
connections, but server_make_connection() in server/sernet.c fails to close
the extra connections.

This patch allows my server to accept all of "localhost", "::1" and
"127.0.0.1". I will continue to run S2_2 with my patch
*p22-listen-plural.diff* to look for bugs. I would like other players to
check if this patch fixes bug #15559, fixes bug #16149, or breaks platforms
other than OpenBSD.

(file #9838)
___

Additional Item Attachment:

File name: p22-plural-listen.diff Size:7 KB


___

Reply to this item at:

  

___
  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 #16419] Server will not start and cannot start new game

2010-08-13 Thread George Koehler

Follow-up Comment #1, bug #16419 (project freeciv):

I tried to reproduce this bug. I installed SVN r17748 of S2_2 into
/home/kernigh/prefix/x-freeciv-2.2 of my OpenBSD system, then started the
client:

$ prefix/x-freeciv-2.2/bin/freeciv-gtk2

The "Start New Game" button produced the same message:

"Starting server
Couldn't connect to the server
We probably couldn't start it from here
You'll have to start one manually. Sorry..."

freeciv-server never started. I found no freeciv-server processes and no
messages about /dev/null or IPv6. So I might not have reproduced the same
bug.



The workaround for me was to add prefix/x-freeciv-2.2/bin to my PATH:

$ PATH=prefix/x-freeciv-2.2/bin:$PATH
$ freeciv-gtk2

Then I can start game like normal.

(I like to skip 'gmake install' and run Freeciv from the build directory
using ./civ, so I never noticed this bug before now.)

___

Reply to this item at:

  

___
  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 #16421] ./civ -a and NEW_PASSWORD_TYPE

2010-08-13 Thread George Koehler

URL:
  

 Summary: ./civ -a and NEW_PASSWORD_TYPE
 Project: Freeciv
Submitted by: kernigh
Submitted on: Friday 08/13/2010 at 22:06
Category: client-gtk-2.0
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: S2_2
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

If you autoconnect to a server that requests a new password (using both
password fields), then freeciv-gtk fails to show the connection screen. This
is because pages.c only calls set_client_page(PAGE_NETWORK) at
ENTER_PASSWORD_TYPE case, not at NEW_PASSWORD_TYPE case.

This is similar to bug #16311, except that the connection becomes stuck at
the main screen instead of the connection screen. The fix for bug #16311 only
fixes ENTER_PASSWORD_TYPE case, not NEW_PASSWORD_TYPE case.

p22-new-password.diff fixes this bug for S2_2; I tested by autoconnecting to
a cazfi.net server that wanted a new password.

p21-new-password.diff is for S2_1, but there are almost no 2.1 servers and I
found none that wanted a new password, so I have not confirmed whether S2_1
has this bug or whether p21-new-password.diff fixes it.



___

File Attachments:


---
Date: Friday 08/13/2010 at 22:06  Name: p21-new-password.diff  Size: 750B  
By: kernigh
add set_client_page(PAGE_NETWORK) to NEW_PASSWORD_TYPE case

---
Date: Friday 08/13/2010 at 22:06  Name: p22-new-password.diff  Size: 750B  
By: kernigh
add set_client_page(PAGE_NETWORK) to NEW_PASSWORD_TYPE case


___

Reply to this item at:

  

___
  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 #16308] Great Wall protects wrong units

2010-08-12 Thread George Koehler

Follow-up Comment #4, bug #16308 (project freeciv):

> Would it be possible to give this defense bonus to every unit placed inside
your national borders?

No. S2_2 has some requirement types that check tiles (like "Special",
"Terrain", "TerrainClass", "Base", "TerrainAlter", "CityTile"), but none of
these can check national borders.

> or to every unit in some of the tiles owned by your cities (workable
tiles)?

No. "CityTile" of S2_2 can only check for city centers ("center"), not for
workable tiles.

> or to every unit in same continent than the Great walls?

Yes, try this:


[effect_great_wall]
name= "Defend_Bonus"
value   = 200
reqs=
{ "type", "name", "range"
  "Building", "Great Wall", "Continent"
  "UnitClass", "Land", "Local"
}

[effect_great_wall_0]
name= "Defend_Bonus"
value   = 200
reqs=
{ "type", "name", "range"
  "Building", "Great Wall", "Continent"
  "UnitClass", "Helicopter", "Local"
}


A comment at common/requirements.c:703 claims, _' At present, "Continent"
effects can affect only cities and units in cities.'_ So there is no way to
give bonus to units who are on continent but not in cities!

>From common/combat.c:442, "Defend_Bonus" only knows three facts:

* the player of the _defending_ unit.
* the _defending_ city.
* the type of the _attacking_ unit.

If there is no city, then the check has no information about the location of
the unit. This is why "Continent" requires a city. "Continent", like
"Player", checks the player. Because of this bug, "Defend_Bonus" checks the
player of the defending unit (not the defending city).

The result is a Great Wall that checks the continent of the defending city
(not the defending unit) and the player of the defending unit (not the
defending city).

___

Reply to this item at:

  

___
  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 #16387] attacker can abuse 'go to' to stop pillager

2010-08-09 Thread George Koehler

Follow-up Comment #3, bug #16387 (project freeciv):

I expected the pillaging to complete before the pillager dies. I might have
confusion about the 'goto' command: because the turn change refills the
movement points of the attacker, I expected the attacker to move _after_ the
turn change. Because the turn change completes the pillaging, I expected the
attacker to kill the pillager _after_ the pillager pillages. If I
misunderstand the usage of movement points at turn change, then this bug
might not be a bug.

The pillager has more than 0 movement points, because the player can cancel
the pillaging action and move the unit before the turn ends.

I think that there is bug if the 'go to' command allows a unit perform a move
that is not normally possible. Because a normal move cannot kill the pillager
before the pillager pillages, I assume that a 'go to' move must not kill the
pillager before the pillager pillages.

___

Reply to this item at:

  

___
  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 #16387] attacker can abuse 'go to' to stop pillager

2010-08-08 Thread George Koehler

URL:
  

 Summary: attacker can abuse 'go to' to stop pillager
 Project: Freeciv
Submitted by: kernigh
Submitted on: Sunday 08/08/2010 at 20:32
Category: None
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2.2+ r17648
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

My enemy has ordered a unit to pillage a road. My unit would attack and kill
the pillager, but my attacker has 0 movement points. Because the pillaging
requires one turn, the pillager will destroy the road at the next turn
change.

Normally, if my attacker waits until the next turn to get movement points,
then the pillager will destroy the road before I can attack.

The bug is that my attacker can use the 'go to' command to kill the pillager.
At the next turn change, the pillager will die but the road will stay!
Therefore, an attacking unit with 0 movement points can abuse the goto
command to stop a pillaging.

I first observed this bug in online 2.1 game (Longturn 20), but I have
reproduced this bug with S2_2 r17648. The attached game
x-pillage-test.sav.bz2 reproduces this bug. Load the game and take player S.
The only way to prevent the pillaging of the road by player P is to abuse 'go
to'.



___

File Attachments:


---
Date: Sunday 08/08/2010 at 20:32  Name: x-pillage-test.sav.bz2  Size: 11kB  
By: kernigh
take player S, abuse 'go to' to stop pillagers


___

Reply to this item at:

  

___
  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 #16311] ./civ -a fails to prompt for password

2010-08-06 Thread George Koehler

Follow-up Comment #6, bug #16311 (project freeciv):

I wrongly fixed it. We must reject my patch (file #9708) because it adds a
bug where the password prompt fails to grab focus when _not_ autoconnecting.

___

Reply to this item at:

  

___
  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 #16311] ./civ -a fails to prompt for password

2010-08-05 Thread George Koehler

Follow-up Comment #5, bug #16311 (project freeciv):

I thank pepeto for mentioning g_idle_add().

Because g_idle_add() delays set_client_page(PAGE_NETWORK), Freeciv sets
NEW_PASSWORD_TYPE or ENTER_PASSWORD_TYPE *before* entering the network page.
The problem is that set_client_page(PAGE_NETWORK) assumes that we want
LOGIN_TYPE.

Here is my patch for S2_2. The idea is to *always* set_connection_type() to
LOGIN_TYPE, NEW_PASSWORD_TYPE or ENTER_PASSWORD_TYPE before doing
set_client_page(PAGE_NETWORK).

The patch fixes the bug for me, but I only tested a few situations:

0 Starting client with no arguments, then clicking "Connect to Network
Game".
0 Autoconnecting to server that wants new password.
0 Autoconnecting to server that wants existing password.

(file #9708)
___

Additional Item Attachment:

File name: p22-autoconnect-password.diff  Size:4 KB


___

Reply to this item at:

  

___
  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 #16339] The "Allies Only" button

2010-08-05 Thread George Koehler

Follow-up Comment #3, bug #16339 (project freeciv):

This might want a checkbox instead of a button.

___

Reply to this item at:

  

___
  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 #16319] Game Crashes at End of Turn

2010-08-04 Thread George Koehler

Follow-up Comment #1, bug #16319 (project freeciv):

I tried to reproduce this bug; I am running OpenBSD and my self-compiled S2_2
r17636 with the GTK client. I loaded file #9628, took the Bretons, moved all
my units, and lastly moved the Trireme along the north pole, and then began
the next turn, but I had no crash or problem.

Perhaps the bug is in the SDL client, or in the Windows version of Freeciv?
Can someone who has the SDL client or runs Windows (or does both) try to
reproduce this bug?

___

Reply to this item at:

  

___
  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 #16338] DNS problems with freeciv.org

2010-08-01 Thread George Koehler

Follow-up Comment #1, bug #16338 (project freeciv):

I have the same problem.

At 24 July 2010, I visited http://freeciv.org where I saw this error message:
'Wikia is sadly having problems. Our front end caches seem to have gone away.
We are working to fix it as soon as possible.' This error was completely
wrong; Wikia was online and http://freeciv.wikia.com was normal. I sent
message to Wikia. I guess that Wikia removed this error message, but no
person fixed http://freeciv.org to go to correct place.

Now http://freeciv.org times out.

___

Reply to this item at:

  

___
  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 #16311] ./civ -a fails to prompt for password

2010-07-27 Thread George Koehler

URL:
  

 Summary: ./civ -a fails to prompt for password
 Project: Freeciv
Submitted by: kernigh
Submitted on: Wednesday 07/28/2010 at 00:59
Category: client-gtk-2.0
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2.2+ r17607
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

With S2_2, if I use ./civ -a to autoconnect to a server that requires a
password, then the gtk client fails to prompt for the password.

S2_1 lacks this bug. With S2_1, './civ -a -s lt20.longturn.org -p 5556' shows
the connection screen and immediately enables the Password field so that I may
enter my password to play Longturn 20, a game for 2.1. (I am running r17607 of
both S2_1 and S2_2.)

S2_2 is not so. With S2_2, './civ -a -s ltex.longturn.org -p ' shows the
connection screen, but enables the Host and Port and Login fields, not the
Password field. There is no way to enter my password. If I click 'Connect',
the client replies, "Connection in progress." As a workaround, I must click
'Cancel' to reach the main screen, then click 'Connect to Network Game' to
make a connection without using the ./civ -a autoconnect feature.

I can only reproduce this bug with a server that requires a password, like
the longturn.org or cazfi.net servers.




___

Reply to this item at:

  

___
  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 #16296] gtk client fails to sort files in load-save dialog

2010-07-27 Thread George Koehler

Follow-up Comment #4, bug #16296 (project freeciv):

I am now running S2_1 and S2_2 with your patches, file #9562 for S2_2 and
file #9560 for S2_1. I confirm that they fix the bug.

___

Reply to this item at:

  

___
  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 #16308] Great Wall protects wrong units

2010-07-26 Thread George Koehler

URL:
  

 Summary: Great Wall protects wrong units
 Project: Freeciv
Submitted by: kernigh
Submitted on: Tuesday 07/27/2010 at 01:10
Category: rulesets
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2.1+ r17591
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

Let player C have the Great Wall. Help text says, "Works as a City Wall in
all your cities." I would expect the Great Wall to protect all units in
cities, where the _cities_ belong to player C. The bug is that the Great Wall
protects all units in cities, where the _units_ belong to player C. (I have
r17591 of S2_2, which has the fix from bug #16080 that actually requires
units to be in cities.)

If player C has alliance with player K, then Great Wall protects whom? Units
of K in cities of C, or units of C in cities of K? I attach
x-great-wall-test.sav.bz2 which shows exactly this problem. (I made this game
with the editing-mode.)

Load x-great-wall-test.sav.bz2 and take player S (Scottish), who is attacking
player C (Chinese) and player K (Korean). Cities marked [C] have three Chinese
defenders; cities marked [K] have three Korean defenders. All units are green
Archers.

* Guangzhou [C] and Shanghai [K] are Chinese cities.
* Wanggomsong [C] and Jolbon [K] are Korean cities with no walls.
* Ungjin [C] and Wandu [K] are Korean cities with City Walls.

Kill all defenders, but never conquer cities. (They might be homecities of
other defenders.) Shanghai [K] and Jolbon[K] are easy to kill; the four other
cities are difficult to kill.

* Guangzhou [C] is a Chinese city with Chinese defenders. Difficult to kill.
Chinese Great Wall protects defenders. No bug.
* Shanghai [K] is a Chinese city with Korean defenders. Easy to kill! Chinese
Great Wall fails to protect Korean defenders in a Chinese city! This is bug.
* Wanggomsong [C] is a Korean city with Chinese defenders. Difficult to kill!
Chinese Great Wall protects Chinese units in a Korean city! This is bug.
* Jolbon [K] is a Korean city with Korean defenders. Easy to kill. No bug.
* Ungjin [C] and Wandu [K] have City Walls. Difficult to kill. No bug.

Chinese Great Wall prevents loss of population in Shanghai [K], but not in
Wanggomsong [C]. This is correct.

I thought that Chinese Great Wall and Korean City Walls might combine to add
protection to Ungjin [C], but this seems not to happen.

These are the current rules in effects.c:


[effect_great_wall]
name= "Defend_Bonus"
value   = 200
reqs=
{ "type", "name", "range"
  "Building", "Great Wall", "Player"
  "UnitClass", "Land", "Local"
  "CityTile", "Center", "Local"
}

[effect_great_wall_0]
name= "Defend_Bonus"
value   = 200
reqs=
{ "type", "name", "range"
  "Building", "Great Wall", "Player"
  "UnitClass", "Helicopter", "Local"
  "CityTile", "Center", "Local"
}


This says to protect all Chinese units in any city (if the attacker is land
or helicopter unit). I would change this to say to protect any unit in all
Chinese cities, if I knew a way.



___

File Attachments:


---
Date: Tuesday 07/27/2010 at 01:10  Name: x-great-wall-test.sav.bz2  Size:
10kB   By: kernigh
play as Scottish; attack Chinese and Korean cities


___

Reply to this item at:

  

___
  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 #16296] gtk client fails to sort files in load-save dialog

2010-07-24 Thread George Koehler

URL:
  

 Summary: gtk client fails to sort files in load-save dialog
 Project: Freeciv
Submitted by: kernigh
Submitted on: Sunday 07/25/2010 at 02:52
Category: client-gtk-2.0
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2.1+ r17591
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

The list of files in the load dialog and save dialog of the gtk-2.0 client is
always a mess! The client never sorts the files, so I have difficulty finding
my file in the list. My newest save files are sometimes near the top,
sometimes near the bottom, so I need to search the entire list. The attached
_games-not-sorted.png_ shows part of this mess.

So I decided to add some code to my copy of 2.2.1+ (r17591) to sort the list.
I found that update_saves_store() in client/gui-gtk-2.0/pages.c grabs the list
from datafilelist_infix() in utility/shared.c, which is trying and failing to
qsort() the files. This is because compare_file_mtime_ptrs() never returns a
value less than zero. This gave me a partially sorted list, very different
from time order (_ls -t_) or name order (_ls_) or filesystem order (_ls
-f_).

My OpenBSD _man qsort_ says, "The comparison function must return an integer
less than, equal to, or greater than zero if the first argument is considered
to be respectively less than, equal to, or greater than the second." So I
fixed compare_file_mtime_ptrs(A, B) to return -1 if A is newer than B. Now
the game sorts the list in _ls -t_ order, and I can find my recent saves at
the top of my list.

_p22-sort-saves.diff_ is my patch for S2_2. I know that 2.1.10 also has the
bug, but I made no patch for 2.1.10. I know nothing about Freeciv trunk.



___

File Attachments:


---
Date: Sunday 07/25/2010 at 02:52  Name: games-not-sorted.png  Size: 71kB  
By: kernigh
screenshot of the problem; patch that fixes S2_2

---
Date: Sunday 07/25/2010 at 02:52  Name: p22-sort-saves.diff  Size: 564B   By:
kernigh
screenshot of the problem; patch that fixes S2_2


___

Reply to this item at:

  

___
  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] [patch #1710] settlers and workers can be veterans

2010-06-21 Thread George Koehler

Follow-up Comment #4, patch #1710 (project freeciv):

I am against file #9348 because it adds a hardcoded exception for "NonMil"
(F_CIVILIAN) units from the "Veteran_Build" effect.

The default ruleset allows communist governments to build veteran Diplomats
(or Spies):


[effect_communism_0]
name= "Veteran_Build"
value   = 1
reqs=
{ "type",   "name",  "range"
  "Gov", "Communism", "Player"
  "UnitFlag", "Diplomat", "Local"
}


But with file #9348, a communist city would never build a veteran Diplomat
(or Spy), because the unit is "NonMil". So file #9348 ruins the default
ruleset.

I prefer file #9333. I have said that file #9333 _'would only affect unit
that have "Settlers" flag or "Cities" flag but lack "NoVeteran" flag. There
are no such units in the default ruleset, because Workers, Engineers and
Settlers have the "NoVeteran" flag.'_

File #9348 is not necessary, because a custom ruleset can separate Barracks
from "NonMil" units, like so:


[effect_barracks]
name= "Veteran_Build"
value   = 1
reqs=
{ "type", "name", "range"
  "Building", "Barracks", "City"
  "UnitClass", "Land", "Local"
}
nreqs   =
{ "type", "name", "range"
  "UnitFlag", "Diplomat", "Local"
  "UnitFlag", "NonMil", "Local"
}

[effect_barracks_1]
name= "HP_Regen"
value   = 100
reqs=
{ "type", "name", "range"
  "Building", "Barracks", "City"
  "UnitClass", "Land", "Local"
}
nreqs   =
{ "type", "name", "range"
  "UnitFlag", "NonMil", "Local"
}



___

Reply to this item at:

  

___
  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] [patch #1710] settlers and workers can be veterans

2010-06-18 Thread George Koehler

Follow-up Comment #2, patch #1710 (project freeciv):

This patch would only affect unit that have "Settlers" flag or "Cities" flag
but lack "NoVeteran" flag. There are no such units in the default ruleset,
because Workers, Engineers and Settlers have the "NoVeteran" flag.

This patch would help custom rulesets that remove the "NoVeteran" flag. The
patch allows the "Veteran_Build" effect (as from Barracks, Barracks II,
Barracks III or Sun Tzu's War Academy) to affect these units.

I encountered this problem during Longturn 17 .
This game used a 2.1 server, and a custom ruleset that removes the
"NoVeteran" flag from Workers and from Engineers. Workers became veteran
through combat ("veteran_raise_chance" in units.ruleset) or through work
("veteran_work_raise_chance"), but not through Barracks. I used a city with
Barracks to build a Workers. I got a green Workers, not a veteran Workers. If
Longturn 17 would use this patch, then I would get a veteran Workers.

Veteran levels have the same purpose for both military and non-military
units. So there is no reason to distinguish military veterans from civilian
veterans. The only purpose is that a veteran Workers is more difficult to
kill than a green Workers.

This is unless the custom ruleset provides a new benefit. Veteran levels in
Longturn 17 grant extra movement points ("veteran_move_bonus" in
units.ruleset), so a veteran Workers does work faster than a green Workers.
This benefit applies equally to military units: my hardened Catapult uses
these extra movement points to reach the enemy to kill.

___

Reply to this item at:

  

___
  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 #15144] notradesize not honored for capital city

2010-01-19 Thread George Koehler

Follow-up Comment #5, bug #15144 (project freeciv):

This bug happened because Freeciv used normal corruption for
notradesize/fulltradesize. Improvements that reduce corruption (Courthouse
and Palace) worked against notradesize/fulltradesize.

I played a game with notradesize=2, fulltradesize=4. Some capital city lost
its only trade point to corruption, but some other capital city had trade
surplus, when all capital cities were size 1 or size 2. Later, I noticed that
AI built Courthouse in many cities. Courthouse increased trade in size 2 and
size 3 cities, including if government was Democracy.

The patch might fix notradesize but not fulltradesize. After I update
Freeciv, I might want to check if Courthouse can still increase trade in
cities between notradesize and fulltradesize; if so, then I might open
another bug.

___

Reply to this item at:

  

___
  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 #15030] 'show' command hates server options with underscores

2010-01-01 Thread George Koehler

URL:
  

 Summary: 'show' command hates server options with
underscores
 Project: Freeciv
Submitted by: kernigh
Submitted on: Friday 01/01/2010 at 20:03
Category: None
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2.0-beta1
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

In 2.2.0-beta1, the 'show' command never hates all server options with
underscores (ec_turns, ec_max_size, ec_chat, ec_info, mgr_turninterval,
mgr_foodneeded, mgr_distance, mgr_nationchance, mgr_worldchance). This
resembles closed bug #13652, but for 'show' instead of 'explain'.

I can show the options with 'show situational' or 'show rare', but not by
prefix or by name. The 'show' command seems to ignore everything not before
the first underscore, so 'show ec_turns' acts like 'show ec'. Then 'show ec'
shows a list of zero options because they are not vital options.

Also, ec_max_size defaults to only 10, even though 'help ec_max_size' thinks
that the default is 256. Thus, 'show changed' includes ec_max_size, though I
never changed it.


$ ./ser
This is the server for Freeciv version 2.2.0-beta1 (beta version)
You can learn a lot about Freeciv at http://www.freeciv.org/

THIS IS A BETA VERSION
Freeciv 2.2.0 will be released in March, at http://www.freeciv.org/

2: Loading rulesets
2: AI*1 has been added as Easy level AI-controlled player.
2: AI*2 has been added as Easy level AI-controlled player.
2: AI*3 has been added as Easy level AI-controlled player.
2: AI*4 has been added as Easy level AI-controlled player.
2: AI*5 has been added as Easy level AI-controlled player.
2: Now accepting new client connections.

For introductory help, type 'help'.
> show changed
--
All options with non-default values
+ means you may change the option
= means the option is on its default value
--
Optionvalue   (min,max)  description
--
ec_max_size   + 10(10,1000)  Size of the event cache
--
> help ec_max_size
Option: ec_max_size  -  Size of the event cache
Description:
  This defines the maximal number of events in the event cache.
Status: changeable
Value: 10, Minimum: 10, Default: 256, Maximum: 1000


'show ec_max_size' fails to show the option.


> show ec_max_size
--
Vital options
+ means you may change the option
= means the option is on its default value
--
Optionvalue   (min,max)  description
--
--
Try 'show situational' or 'show rare' to show more options.
Try 'show changed' to show settings with non-default values.
--


'show a' shows the vital options that start with 'a', but so does 'show
a_bug'.


> show a_bug
--
Vital options
+ means you may change the option
= means the option is on its default value
--
Optionvalue   (min,max)  description
--
aifill+=5 (0,30) Limited number of AI players
--
Try 'show situational' or 'show rare' to show more options.
Try 'show changed' to show settings with non-default values.
--


'show migration' works (because that option has no underscore), but 'show
mgr_distance' fails.

'show bad_option' gives an error message that mentions 'bad' instead of
'bad_option'.


> show bad_option
Unknown option 'bad'.


'show mgr' shows a list of zero options, because they are not vital options.
So I cannot use 'show mgr_distance' nor 'show mgr' to see mgr_distance.
Likewise, 'show dip' shows a list of zero options, because none of them
(diplcost, diplomacy, diplchance) are vital options.


> show dip
--
Vital options
+ means you may change the option
= means the opti

[Freeciv-Dev] [bug #15024] beta civserver crashes at startup

2009-12-31 Thread George Koehler

Follow-up Comment #3, bug #15024 (project freeciv):

Yes, your fix (file #7562) works for me. I applied the patch to 2.2.0-beta1.
Thank you! Now I can play local game instead of needing a public server.

PowerPC likes to pass the first eight function arguments (excepting
floating-point) through the general purpose registers %r3 through %r10. Two
const char * arguments might look like _foreground_ in %r7 and _background_
in %r8. A struct counts as one argument, with a pointer to the struct in the
register; a struct ft_color might look like a pointer in %r7, with
_foreground_ in 0(%r7) and _background_ in 4(%r7).

Your fix also changed some comments, but forgot to fix the comment at line
370 above the text_tag_initv() function in featured_text.c.

Now I can play and enjoy the freeciv beta, and hopefully not find any other
bugs!

___

Reply to this item at:

  

___
  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 #15024] beta civserver crashes at startup

2009-12-31 Thread George Koehler

URL:
  

 Summary: beta civserver crashes at startup
 Project: Freeciv
Submitted by: kernigh
Submitted on: Thursday 12/31/2009 at 17:54
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.2.0-beta1
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: 

___

Details:

I have compiled freeciv-2.2.0-beta1 for my OpenBSD/macppc machine. The
civserver always dumps core immediately after startup.

This is how to reproduce the crash:


$ cd ~/park/freeciv-2.2.0-beta1/work
$ ./ser
This is the server for Freeciv version 2.2.0-beta1 (beta version)
You can learn a lot about Freeciv at http://www.freeciv.org/

THIS IS A BETA VERSION
Freeciv 2.2.0 will be released in March, at http://www.freeciv.org/

2: Loading rulesets
2: AI*1 has been added as Easy level AI-controlled player.
Segmentation fault (core dumped) 
$ gdb server/freeciv-server freeciv-server.core
GNU gdb 6.3
Copyright 2004 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 "powerpc-unknown-openbsd4.5"...
Core was generated by `freeciv-server'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libiconv.so.6.0...done.
Loaded symbols for /usr/local/lib/libiconv.so.6.0
Reading symbols from /usr/local/lib/libintl.so.4.0...done.
Loaded symbols for /usr/local/lib/libintl.so.4.0
Reading symbols from /usr/lib/libreadline.so.3.0...done.
Loaded symbols for /usr/lib/libreadline.so.3.0
Reading symbols from /usr/lib/libncurses.so.10.0...done.
Loaded symbols for /usr/lib/libncurses.so.10.0
Reading symbols from /usr/lib/libm.so.5.0...done.
Loaded symbols for /usr/lib/libm.so.5.0
Reading symbols from /usr/local/lib/libbz2.so.10.4...done.
Loaded symbols for /usr/local/lib/libbz2.so.10.4
Reading symbols from /usr/lib/libz.so.4.1...done.
Loaded symbols for /usr/lib/libz.so.4.1
Reading symbols from /usr/lib/libc.so.50.1...done.
Loaded symbols for /usr/lib/libc.so.50.1
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  0x018a50e4 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:412
412   if (NULL != background && '\0' != background[0]) {
(gdb) bt full
#0  0x018a50e4 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:412
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#1  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#2  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#3  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#4  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#5  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#6  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#7  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#8  0x018a5118 in text_tag_initv (ptag=0x2cc0, type=4294913376, 
start_offset=32, stop_offset=-1, args=0x2cb0)
at ../../common/featured_text.c:407
foreground = 0x2d60 "\001\231U°"
background = 0x1 
#9  0x018a5118 in text_tag_initv (ptag

[Freeciv-Dev] [bug #14751] configure fails to detect SDL_mixer

2009-11-12 Thread George Koehler

URL:
  

 Summary: configure fails to detect SDL_mixer
 Project: Freeciv
Submitted by: kernigh
Submitted on: Thursday 11/12/2009 at 21:15
Category: client
Severity: 2 - Minor
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 2.1.9
 Discussion Lock: Any
Operating System: *BSD
 Planned Release: None

___

Details:

When I build freeciv-2.1.9 from source, the configure script fails to detect
SDL_mixer, so civclient has no sound. I build the GTK+ 2 client. My operating
system is OpenBSD.

My configure arguments were --prefix=/home/kernigh/prefix
CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib

The detection fails because the AC_CHECK_LIB in m4/sound.m4 forgets to use
SDL_LIBS (the output of sdl-config --libs) when checking SDL_mixer. For my
OpenBSD system, sdl-config --libs provides some extra flags that are always
necessary when linking to SDL, or to any library that requires SDL.


$ sdl-config --cflags
-I/usr/local/include -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
-I/us
r/X11R6/include -DXTHREADS
$ sdl-config --libs
-L/usr/local/lib -lSDL -pthread -L/usr/X11R6/lib -R/usr/X11R6/lib


(OpenBSD system gcc is not searching /usr/local by default. OpenBSD has X11R7
in /usr/X11R6.)

So I modified m4/sound.m4 to use SDL_CFLAGS and SDL_LIBS when checking
SDL_mixer (similar to how m4/sdl-client.m4 uses SDL_CFLAGS and SDL_LIBS when
checking SDL_image). I have attached a patch.

I also changed the header check in m4/sound.m4. The check is for
'SDL_mixer.h' and *not* 'SDL/SDL_mixer.h', because 'SDL_mixer.h' is the
correct way to include the file (and because client/audio_sdl.c includes
'SDL_mixer.h').

After I modified m4/sound.m4, I ran 'aclocal -I m4' and 'autoconf' to
regenerate configure, then I rebuilt and reinstalled freeciv. I _immediately_
encountered another bug. My civclient, linked with SDL_mixer, dumped core at
startup.


$ civclient
civclient:/usr/local/lib/libSDL_mixer.so.3.0: civclient : WARNING:
symbol(curren
t_filename) size mismatch, relink your program
Segmentation fault (core dumped)


I found two global variables named 'current_filename': one in civclient (an
ELF executable) and one in SDL_mixer (an ELF shared library). The 'WARNING:'
line comes from /usr/libexec/ld.so, the dynamic linker for ELF shared
libraries. ELF seems to have one level of symbol resolution, so
'current_filename' can be only one variable. To solve the conflict, I must
rename one of the two variables.

In civclient, client/connectdlg_common.[ch] declares a global variable named
'current_filename', sized 4 bytes. My libSDL_mixer.so.3.0 declares a
different global variable also named 'current_filename', sized 1024 bytes.


$ readelf -s /usr/local/lib/libSDL_mixer.so.3.0 |
> fgrep current_filename
   234: 0008fe10  1024 OBJECT  GLOBAL DEFAULT   27 current_filename


I think that my libSDL_mixer.so.3.0 is wrong to export 'current_filename',
but I am too lazy to fix and rebuild SDL_mixer. So I instead added a '#define
current_filename freeciv_current_filename' to client/connectdlg_common.h in
freeciv.

Then I rebuilt and reinstalled freeciv, and the civclient had perfect sound!

The attached freeciv-detect-sdl-mixer.patch edits both m4/sound.m4 and
client/connectdlg_common.h. This allows configure to detect SDL_mixer, and
prevents the 'current_filename' conflict. Remember to run 'aclocal -I m4' and
'autoconf' after applying the patch.

Please fix this bug in the next version of freeciv.



___

File Attachments:


---
Date: Thursday 11/12/2009 at 21:15  Name: freeciv-detect-sdl-mixer.patch 
Size: 1kB   By: kernigh
diff for both m4/sound.m4 and client/connectdlg_common.h


___

Reply to this item at:

  

___
  Message sent via/by Gna!
  http://gna.org/


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