After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 362983 - Require bind_textdomain_codeset() unconditionally
Require bind_textdomain_codeset() unconditionally
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.2.x
Other All
: Normal major
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-10-17 21:58 UTC by Pav Lucistnik
Modified: 2008-01-15 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Pav Lucistnik 2006-10-17 21:58:07 UTC
GIMP crashes on startup, in gimp_real_restore routine, when executed under non-UTF8 locale as cs_CZ.ISO8859-2 or fr_FR.ISO8859-15.

In plug_ins_file_proc_compare() function, two non-utf8 strings are passed to glib's g_utf8_collate() function.

Crash does not happen under UTF8 version of cs_CZ or fr_FR locales, not under LANG=C.

This crash is new with GNOME 2.16 (glib 2.12.4), it is not happening under GNOME 2.14 (glib 2.10.3).

Backtrace:
(gdb) bt
  • #0 strcmp
    from /lib/libc.so.6
  • #1 IA__g_utf8_collate
    at gunicollate.c line 116
  • #2 plug_ins_file_proc_compare
    at plug-ins.c line 1050
  • #3 g_slist_sort_merge
    at gslist.c line 557
  • #4 g_slist_sort_real
    at gslist.c line 599
  • #5 g_slist_sort_real
    at gslist.c line 599
  • #6 g_slist_sort_real
    at gslist.c line 599
  • #7 g_slist_sort_real
    at gslist.c line 599
  • #8 g_slist_sort_real
    at gslist.c line 599
  • #9 g_slist_sort_real
    at gslist.c line 599
  • #10 IA__g_slist_sort_with_data
    at gslist.c line 617
  • #11 plug_ins_init
    at plug-ins.c line 320
  • #12 gimp_real_restore
    at gimp.c line 655
  • #13 IA__g_cclosure_marshal_VOID__POINTER
    at gmarshal.c line 601
  • #14 g_type_class_meta_marshal
    at gclosure.c line 567
  • #15 IA__g_closure_invoke
    at gclosure.c line 490
  • #16 signal_emit_unlocked_R
    at gsignal.c line 2478
  • #17 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #18 IA__g_signal_emit
    at gsignal.c line 2243
  • #19 gimp_restore
    at gimp.c line 887
  • #20 app_run
    at app_procs.c line 286
  • #21 main
    at main.c line 477

Note in frame 1, the arguments are iso8859-2 encoded strings.

Advise if this is bug in GIMP (passing non-UTF8 strings to g_utf8_*), or glib bug, please.
Comment 1 Sven Neumann 2006-10-18 07:17:24 UTC
This looks like a bug in gettext or a problem with your GIMP build. GIMP explicitly calls bind_textdomain_codeset() so that all translations are delivered in UTF-8 encoding, no matter what locale you are using. So either gettext is broken on your system or GIMP was built without support for bind_textdomain_codeset(). The availability of this function is being checked when configure is run at build time. If you built gimp yourself, please have a look at config.h and config.log and look for HAVE_BIND_TEXTDOMAIN_CODESET.
Comment 2 Michael Natterer 2006-10-18 07:39:00 UTC
(regardless of the reason for this bug:)

Since a missing bind_textdomain_codeset() results in a crash because
gettext() automatically converts to LC_CTYPE in its absence, shouldn't
we requite it unconditionally?

Reopening and setting milestone since this is easy enough to sort
out for 2.4 and shouldn't be forgotten.
Comment 3 Pav Lucistnik 2006-10-18 08:35:45 UTC
quoting config.h:
 49 /* Define to 1 if you have the `bind_textdomain_codeset' function. */
 50 #define HAVE_BIND_TEXTDOMAIN_CODESET 1

Could the problem be, that, for example, fax3g's query() routine does not call INIT_I18N() macro? It's called only in run() routine. Adding that call there "moves" the crash to other plugins...
Comment 4 Michael Natterer 2006-10-18 09:52:14 UTC
I think i found the bug here. Can you try the following:

- go to app/plug-in/plug-ins.c
- search for gimp_menus_init()
- move it up a few lines, right to the start of the
  if (! gimp->no_interface) scope
Comment 5 Pav Lucistnik 2006-10-18 10:36:33 UTC
Confirmed, steps described in #4 do fix the startup crash for me.
Comment 6 Michael Natterer 2006-10-18 15:07:39 UTC
Fixed in CVS. Leaving open and changing summary to cover the
bind_textdomain_codeset() issue.

2006-10-18  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/plug-ins.c (plug_ins_init): initialize the plug-in
	translation domains before using them. Fixes bug #362983.
Comment 7 Sven Neumann 2006-12-07 11:33:43 UTC
2006-12-07  Sven Neumann  <sven@gimp.org>

	* configure.in: require bind_textdomain_codeset(). Fixes bug #362983.