[Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gt
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10027 >
Brett Albertson wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10027 >
>
>>[jdorje - Fri Sep 10 23:42:17 2004]:
>>
>>Brett Albertson wrote:
>>
>>
>>>UTF-8 core dumps:
>>>
>>>dev-null:{bretta}$ FREECIV_LOCAL_ENCODING=UTF8 civclient
>>>Encodings: Data=UTF-8, Local=UTF8, Internal=UTF-8
>>>Segmentation Fault (core dumped)
>>>dev-null:{bretta}$ FREECIV_LOCAL_ENCODING=UTF-8 civclient
>>>Encodings: Data=UTF-8, Local=UTF-8, Internal=UTF-8
>>>Segmentation Fault (core dumped)
>>
>>Core dumps??? Can you give a backtrace?
Oops! This is a real bug...
We can't safely call freelog from inside convert_string, since freelog
will call convert_string. The easiest solution (see patch) is to just
use fprintf. This means some characters may not be correctly converted,
and thwarts any use of logfiles that freelog may do.
The alternative is to do something clever, like a static
"recursion_count" variable in convert_string. We might allow a few
recursions then just give up and return the original string unconverted.
When I wrote this function I assumed that any conversion errors would be
because of bad input, so a freelog (which gives good input) would be
safe enough to do. However it seems often when things go wrong it's
because the charsets aren't properly detected, meaning no conversion
will succeed.
jason
Index: utility/fciconv.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/fciconv.c,v
retrieving revision 1.3
diff -u -r1.3 fciconv.c
--- utility/fciconv.c 10 Sep 2004 21:51:47 -0000 1.3
+++ utility/fciconv.c 11 Sep 2004 00:01:36 -0000
@@ -140,6 +140,8 @@
const char *to,
char *buf, size_t bufsz)
{
+ /* Note we can't use freelog in this function, since it will convert its
+ * strings potentially causing a recursive loop. */
#ifdef HAVE_ICONV
iconv_t cd = iconv_open(to, from);
size_t from_len = strlen(text) + 1, to_len;
@@ -149,7 +151,9 @@
assert(text != NULL);
if (cd == (iconv_t) (-1)) {
- freelog(LOG_ERROR,
+ /* We can't use freelog here since that might cause a recursive loop. */
+ fprintf(stderr,
+ /* TRANS: Obscure character set (iconv) conversion error. */
_("Could not convert text from %s to %s: %s"),
from, to, strerror(errno));
/* The best we can do? */
@@ -186,8 +190,11 @@
if (res == (size_t) (-1)) {
if (errno != E2BIG) {
/* Invalid input. */
- freelog(LOG_ERROR, "Invalid string conversion from %s to %s.",
- from, to);
+ /* We can't use freelog here since that might cause a
+ * recursive loop. */
+ fprintf(stderr,
+ /* TRANS: Obscure character set (iconv) conversion error. */
+ _("Invalid string conversion from %s to %s."), from, to);
iconv_close(cd);
if (alloc) {
free(buf);
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, (continued)
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Jason Short, 2004/09/10
- [Freeciv-Dev] (PR#10027) Re: (PR#10029) (civclient:12460): WARNING **: Invalid UTF8 string passed to pango_layout_set_text(), Jason Short, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Jason Short, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Jason Short, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed,
Jason Short <=
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Jason Short, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Brett Albertson, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Jason Short, 2004/09/10
- [Freeciv-Dev] Re: (PR#10027) (civclient:12460): Gtk-CRITICAL **: file gtktextbuffer.c: line 548: assertion `g_utf8_validate (text, len, NULL)' failed, Vasco Alexandre da Silva Costa, 2004/09/11
|
|