Bug 119099

Summary: gnome-terminal crashes while inserting text
Product: [Fedora] Fedora Reporter: Kir Kolyshkin <kir>
Component: gnome-terminalAssignee: Ray Strode [halfline] <rstrode>
Severity: high Docs Contact:
Priority: medium    
Version: rawhideCC: mitr, sundaram, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: 2-2.4.10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-04 20:47:32 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 114961, 123268    

Description Kir Kolyshkin 2004-03-24 20:25:01 EST
Description of problem:
Gnome-terminal crashes while trying to insert some long text.

Version-Release number of selected component (if applicable):

How reproducible:
Always. Tried several times with various different long texts.

Steps to Reproduce:
1. Open http://slashdot.org/ (or http://freshmeat.net/) in Mozilla.
Press Ctrl-A to select all text and copy it to clipboard.
2. Open xterm, type in export LANG=ru_RU.KOI8-R
2. Run gnome-terminal from xterm, type vim xxxx (where xxxx is
non-existing file name), press i to enter insert mode in vim.
3. Click Shift+Middle mouse button in gnome-terminal to insert the
text from clipboard. Nothing happens, gnome-terminal just issues a
warning about invalid UTF-8 string. Click Shift+MidButton again.
Actual results:
gnome-terminal crashes with the following message:

(process:17319): GLib-CRITICAL (recursed) **: file gstring.c: line 672
(g_string_erase): assertion `pos >= 0' failed

(gnome_segv:17362): Gtk-WARNING **: Ignoring the separator setting

Expected results:
there should be no crash

Additional info:
Here is my locale setting: LANG=ru_RU.KOI8-R
The bug is NOT reproducible if I set LANG=ru_RU.UTF-8. The bug is NOT
reproducible if I change gnome-terminal encoding to unicode (Menu ->
Terminal -> Encoding -> Unicode (UTF-8). Note that default encoding is
set to current locale (KOI8-R in my case).

Relevant software versions:
$ rpm -q glib gtk2 pango gnome-terminal glibc

Bug-Buddy generates the following backtrace (I suspect it's useless
but still):
Backtrace was generated from '/usr/bin/gnome-terminal'

(no debugging symbols found)...[New Thread 1089607776 (LWP 17632)]
0xffffe410 in ?? ()
#0  0xffffe410 in ?? ()
#1  <signal handler called>
#2  0xffffe410 in ?? ()
#3  0x40ba6c47 in abort () at ../sysdeps/generic/abort.c:88
#4  0x40b2ef6b in g_logv (log_domain=0x40b4cba6 "GLib", 
    format=0x40b4cd64 "file %s: line %d (%s): assertion `%s' failed", 
    args1=0xbfffe53c "

Feel free to ask for more details if you will be unable to reproduce
this bug.
Comment 1 Kir Kolyshkin 2004-03-25 18:21:29 EST
Seems I have reported glib 1.x version, while I should report glib2
version. So here it is:
$ rpm -q glib2 gtk2 atk pango glibc

Will try to reproduce the bug with latest gtk2, pango and atk.
Comment 2 Kir Kolyshkin 2004-03-25 18:53:47 EST
Bad news is with gtk2, pango and atk updated to the latest versions,
the bug is still reproducible.
Good news is I have reveived a better backtrace.
** (gnome-terminal:8227): WARNING **: [Invalid UTF-8]
\xd2\xcf\xc9\xc9\xda\xcf\xdb\xcc\xc1 \xcf\xdb\xc9\xc2\xcb\xc1 (Invalid
or incomplete multibyte or wide character) \xd0\xd2\xc9
\xc4\xc1\xce\xce\xd9\xc8 \xcf\xd4 \xd0\xcf\xd4\xcf\xcd\xcb\xc1,

** (gnome-terminal:8227): WARNING **:
\xd2\xcf\xc9\xda\xcf\xdb\xcc\xc1\x20 \xdb\xc9\xc2\xcb\xc1\x20 (Invalid
or incomplete multibyte or wide character) \xd2\xc9\x20
\xc1\xce\xce\xd9\xc8\x20 \xd4\x20 \xcf\xd4\xcf\xcd\xcb\xc1\x2c,

(process:8227): GLib-CRITICAL (recursed) **: file gstring.c: line 672
(g_string_erase): assertion `pos >= 0' failed

Program received signal SIGABRT, Aborted.
[Switching to Thread 1089144928 (LWP 8227)]
0xffffe410 in ?? ()
(gdb) bt
#0  0xffffe410 in ?? ()
#1  0x40b35c47 in abort () at ../sysdeps/generic/abort.c:88
#2  0x40abdf6b in g_logv (log_domain=0x40adbba6 "GLib", 
    format=0x40adbd64 "file %s: line %d (%s): assertion `%s' failed", 
    args1=0xbfffe53c "║#╝@═\002") at gmessages.c:522
#3  0x40abdfa4 in g_log (log_domain=0x0, log_level=0, format=0x0)
    at gmessages.c:541
#4  0x40acda9f in g_string_erase (string=0x80ca12c, pos=6, len=1)
    at gstring.c:682
#5  0x40abe5c7 in escape_string (string=0x80ca12c) at gmessages.c:795
#6  0x40abe702 in g_log_default_handler (log_domain=0x80ca12c "\220m'\b", 
    message=0x8276d10 "Произошла ошибка (Invalid or incomplete
multibyte or wide character) при преобразовании данных от потомка,
    unused_data=0x0) at gmessages.c:888
#7  0x40abde08 in g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_WARNING, 
    format=0x80b95bc "Произошла ошибка (%s) при преобразовании данных
от потомка, отбрасывается.", args1=0xbfffea8c "Д|а@хЙЪ©\2007б@\001")
at gmessages.c:503
#8  0x40abdfa4 in g_log (log_domain=0x0, log_level=0, format=0x0)
    at gmessages.c:541
#9  0x4037f821 in vte_terminal_send (terminal=0x81996d0, 
    encoding=0x40408cde "UTF-8", data=0x0, length=11038, local_echo=0, 
---Type <return> to continue, or q <return> to quit---
    newline_stuff=0) at vte.c:7566
#10 0x4037f9c9 in vte_terminal_feed_child (terminal=0x81996d0, 
    data=0x831c7d8 "   OSDN : SourceForge - Shop ThinkGeek - freshmeat
- Newsletters - TechJobs - Personals - Slashdot Broadband  \tSearch б╩
  \t X \r\t\t\t\t\t\r kreazy\r Preferences\r Subscribe\r Journal\r
Logout\r\r Sections\r Main\r"..., length=11038) at vte.c:7676
#11 0x4038123a in vte_terminal_paste_cb (clipboard=0x83b47f8, 
    text=0x81996d0 "п\210\031\b\004", data=0x2b1e) at vte.c:8403
#12 0x4062c051 in request_text_received_func (clipboard=0x83b47f8, 
    selection_data=0xbfffef70, data=0x83b4140) at gtkclipboard.c:805
#13 0x4062beab in selection_received (widget=0x83b4140, 
    selection_data=0xbfffef70, time=251767) at gtkclipboard.c:717
#14 0x406cee6c in _gtk_marshal_VOID__BOXED_UINT (closure=0x83c88b0, 
    return_value=0x0, n_param_values=3, param_values=0x83b4140, 
    invocation_hint=0xbfffeca8, marshal_data=0x0) at gtkmarshalers.c:1180
#15 0x40a35ec9 in g_closure_invoke (closure=0x83c88b0, return_value=0x0, 
    n_param_values=0, param_values=0x0, invocation_hint=0x0) at
#16 0x40a48c9c in signal_emit_unlocked_R (node=0x8174228, detail=0, 
    instance=0x82a73c8, emission_return=0x0,
    at gsignal.c:2436
#17 0x40a47d04 in g_signal_emit_valist (instance=0x82a73c8, 
    signal_id=138184880, detail=0, var_args=0xbfffef70 "\001")
    at gsignal.c:2195
---Type <return> to continue, or q <return> to quit---
#18 0x40a480e3 in g_signal_emit_by_name (instance=0x82a73c8, 
    detailed_signal=0x407e3477 "selection_received") at gsignal.c:2263
#19 0x4070ed7d in gtk_selection_retrieval_report (info=0x83b4b18,
    format=0, buffer=0x0, length=0, time=0) at gtkselection.c:1804
#20 0x4070eb5c in _gtk_selection_property_notify (widget=0x82a73c8, 
    event=0x82f8178) at gtkselection.c:1688
#21 0x406cd5b0 in _gtk_marshal_BOOLEAN__BOXED (closure=0x83b4b18, 
    return_value=0xbffff100, n_param_values=2, param_values=0x82f8178, 
    invocation_hint=0xbffff128, marshal_data=0x4070ea10) at
#22 0x40a36217 in g_type_class_meta_marshal (closure=0x82f8178, 
    return_value=0x0, n_param_values=0, param_values=0x83b4b18, 
    invocation_hint=0x0, marshal_data=0x0) at gclosure.c:514
#23 0x40a35ec9 in g_closure_invoke (closure=0x83b4b18, return_value=0x0, 
    n_param_values=0, param_values=0x0, invocation_hint=0x0) at
#24 0x40a4870a in signal_emit_unlocked_R (node=0x8173e28, detail=0, 
    instance=0x82a73c8, emission_return=0xbffff1e0, 
    instance_and_params=0xbffff240) at gsignal.c:2474
#25 0x40a47af3 in g_signal_emit_valist (instance=0x82a73c8, 
    signal_id=138103576, detail=0, var_args=0xbffff3d0 "ХСЪ©")
    at gsignal.c:2205
#26 0x40a47ff4 in g_signal_emit (instance=0x0, signal_id=0, detail=0)
    at gsignal.c:2239
#27 0x407c3ceb in gtk_widget_event_internal (widget=0x82a73c8,
---Type <return> to continue, or q <return> to quit---
    at gtkwidget.c:3563
#28 0x406caabd in gtk_main_do_event (event=0x82a73c8) at gtkmain.c:1605
#29 0x408cef41 in gdk_event_dispatch (source=0x0, callback=0,
    at gdkevents-x11.c:2133
#30 0x40ab5710 in g_main_dispatch (context=0x80afe68) at gmain.c:1895
#31 0x40ab6748 in g_main_context_dispatch (context=0x80afe68) at
#32 0x40ab6a76 in g_main_context_iterate (context=0x80afe68, block=1, 
    dispatch=1, self=0x80a6080) at gmain.c:2522
#33 0x40ab7083 in g_main_loop_run (loop=0x80b0570) at gmain.c:2726
#34 0x406ca353 in gtk_main () at gtkmain.c:1172
#35 0x0805e539 in main (argc=2, argv=0xbffff684) at terminal.c:1669
#36 0x40b21eab in __libc_start_main (main=0x805e0e0 <main>, argc=2, 
    ubp_av=0xbffff684, init=0x807e14c <__libc_csu_init>, fini=0x2, 
    rtld_fini=0x8088e48 <environ@@GLIBC_2.0>, stack_end=0xbffff67c)
    at ../sysdeps/generic/libc-start.c:209

Feel free to request more info, such as local variables etc.
Comment 3 Warren Togami 2004-04-10 23:04:45 EDT
If this is still an issue with latest rawhide, you should probably
talk to upstream GNOME and make sure this is filed somewhere upstream
in order to get more exposure.
Comment 4 Kir Kolyshkin 2004-04-11 15:27:14 EDT
Bug is still reproducible with the following (newer except for the
pango) versions:
$ rpm -q glib2 gtk2 atk pango glibc gnome-terminal glibc

So as you have suggested I have filed a bug to GNOME's bugzilla:
That bug have a newer backtrace (from gnome-terminal 2.6.0).
Comment 5 Matthias Clasen 2004-09-29 01:48:25 EDT
This should be fixed in gtk2-2.4.10, I think. Can you check ?