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 441618 - Message-ID/news-Link crashes gnome-terminal
Message-ID/news-Link crashes gnome-terminal
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
2.18.x
Other All
: Normal critical
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-05-27 16:48 UTC by Andy Price
Modified: 2007-11-27 03:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Stacktrace for the bug (2.17 KB, text/plain)
2007-05-27 22:26 UTC, Andy Price
Details

Description Andy Price 2007-05-27 16:48:51 UTC
Steps to reproduce:
1. Type the following string into a gnome-terminal: news:4617aab5.13099750@T-Online-Team.dialin.t-online.de
2. Right-click on the link and select "Open link"
3. Watch you gnome-terminal windows disappear

Stack trace:


Other information:
This bug was forwarded from Ubuntu 7.04. The original bug with stack traces etc is at https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/117210

Thanks
Comment 1 Andy Price 2007-05-27 22:26:41 UTC
Created attachment 88916 [details]
Stacktrace for the bug

I attached this stack trace to the ubuntu bug on launchpad but here it is again for your convenience.

Also, the bug seems to be reproducible with any link in the form news:foo@bar
Comment 2 Sitsofe Wheeler 2007-05-28 15:53:20 UTC
I can reproduce this every time too on Ubuntu 7.04 using gnome-terminal 2.18.0-0ubuntu1 . Here's my backtrace:

(gdb) bt
  • #0 __kernel_vsyscall
  • #1 raise
    from /lib/tls/i686/cmov/libc.so.6
  • #2 abort
    from /lib/tls/i686/cmov/libc.so.6
  • #3 IA__g_logv
  • #4 IA__g_log
  • #5 IA__g_assert_warning
    at gmessages.c line 552
  • #6 open_url
    at terminal-screen.c line 1479
  • #7 open_url_callback
    at terminal-screen.c line 1512
  • #8 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #9 IA__g_closure_invoke
    at gclosure.c line 490
  • #10 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #11 IA__g_signal_emit_valist
    at gsignal.c line 2199
  • #12 IA__g_signal_emit
    at gsignal.c line 2243
  • #13 IA__gtk_widget_activate
    at gtkwidget.c line 3946
  • #14 IA__gtk_menu_shell_activate_item
    at gtkmenushell.c line 1024
  • #15 gtk_menu_shell_button_release
    at gtkmenushell.c line 630
  • #16 gtk_menu_button_release
    at gtkmenu.c line 2625
  • #17 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 84
  • #18 g_type_class_meta_marshal
    at gclosure.c line 567
  • #19 IA__g_closure_invoke
  • #20 signal_emit_unlocked_R
    at gsignal.c line 2478
  • #21 IA__g_signal_emit_valist
    at gsignal.c line 2209
  • #22 IA__g_signal_emit
    at gsignal.c line 2243
  • #23 gtk_widget_event_internal
    at gtkwidget.c line 3915
  • #24 IA__gtk_propagate_event
    at gtkmain.c line 2364
  • #25 IA__gtk_main_do_event
    at gtkmain.c line 1598
  • #26 gdk_event_dispatch
    at gdkevents-x11.c line 2318
  • #27 IA__g_main_context_dispatch
    at gmain.c line 2045
  • #28 g_main_context_iterate
    at gmain.c line 2677
  • #29 IA__g_main_loop_run
    at gmain.c line 2881
  • #30 IA__gtk_main
    at gtkmain.c line 1177
  • #31 main
    at terminal.c line 1773

Comment 3 Andy Price 2007-05-28 16:45:24 UTC
Also reproduced on Fedora 7 (latest test release) with gnome-terminal 2.18.0-1.fc7
Comment 4 Sitsofe Wheeler 2007-05-28 17:06:13 UTC
terminal-screen.c defines 4 different "address" types in terminal_screen_init():

terminal_screen_init (TerminalScreen *screen)
{

[..]

#define USERCHARS "-A-Za-z0-9"
#define PASSCHARS "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
#define HOSTCHARS "-A-Za-z0-9"
#define PATHCHARS "-A-Za-z0-9_$.+!*(),;:@&=?/~#%"
#define SCHEME    "(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)"
#define USER      "[" USERCHARS "]+(:["PASSCHARS "]+)?"
#define URLPATH   "/[" PATHCHARS "]*[^]'.}>) \t\r\n,\\\"]"

  terminal_widget_match_add (screen->priv->term,
			     "\\<" SCHEME "//(" USER "@)?[" HOSTCHARS ".]+"
			     "(:[0-9]+)?(" URLPATH ")?\\>/?", FLAVOR_AS_IS);

  terminal_widget_match_add (screen->priv->term,
			     "\\<(www|ftp)[" HOSTCHARS "]*\\.[" HOSTCHARS ".]+"
			     "(:[0-9]+)?(" URLPATH ")?\\>/?",
			     FLAVOR_DEFAULT_TO_HTTP);

  terminal_widget_match_add (screen->priv->term,
			     "\\<(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9]"
			     "[a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+\\>",
			     FLAVOR_EMAIL);

  terminal_widget_match_add (screen->priv->term,
			     "\\<news:[-A-Z\\^_a-z{|}~!\"#$%&'()*+,./0-9;:=?`]+"
			     "@[" HOSTCHARS ".]+(:[0-9]+)?\\>", FLAVOR_AS_IS);

[...]
}

This creates 4 flags with 3 flavors. Here's a snippet of terminal_widget_match_add() out of terminal-widget-vte.c:

void
terminal_widget_match_add                  (GtkWidget            *widget,
					    const char           *regexp,
                                            int                   flavor)
{
  TagData *tag_data;
  VteData *data;
  int tag;
  
  data = g_object_get_data (G_OBJECT (widget), "terminal-widget-data");

  tag = vte_terminal_match_add (VTE_TERMINAL (widget), regexp);

  tag_data = g_new0 (TagData, 1);
  tag_data->tag = tag;
  tag_data->flavor = flavor;

  data->url_tags = g_slist_append (data->url_tags, tag_data);
}

Both the the tag and the flavor are set.

In terminal-widget-vte.c there is terminal_widget_check_match which returns the flavor of matched addresses:

char*
terminal_widget_check_match (GtkWidget *widget,
			     int        column,
			     int        row,
                             int       *flavor)
{
  VteData *data;
  GSList *tags;
  gint tag;
  char *match;
   
  data = g_object_get_data (G_OBJECT (widget), "terminal-widget-data");

  match = vte_terminal_match_check(VTE_TERMINAL(widget), column, row, &tag);
  for (tags = data->url_tags; tags != NULL; tags = g_slist_next(tags))
    if (GPOINTER_TO_INT(((TagData*)tags->data)->tag) == tag)
      {
        if (flavor)
          *flavor = tag;
        return match;
      }

  g_free (match);
  return NULL;
}

Now I could be wrong but look at how flavor is set from tag not from flavor. This could be the root of the problem...
Comment 5 Sitsofe Wheeler 2007-05-28 17:10:33 UTC
I guess I should also post a code snippet from the area which calls the assertion:

enum {
  FLAVOR_AS_IS,
  FLAVOR_DEFAULT_TO_HTTP,
  FLAVOR_EMAIL
};

static void
open_url (TerminalScreen *screen,
          const char     *orig_url,
          int             flavor)
{
[..]
  switch (flavor)
    {
    case FLAVOR_DEFAULT_TO_HTTP:
      url = g_strdup_printf ("http:%s", orig_url);
      break;
    case FLAVOR_EMAIL:
      if (strncmp ("mailto:", orig_url, 7))
	url = g_strdup_printf ("mailto:%s", orig_url);
      else
	url = g_strdup (orig_url);
      break;
    case FLAVOR_AS_IS:
      url = g_strdup (orig_url);
      break;
    default:
      url = NULL;
      g_assert_not_reached ();
    }

It might be fun to shuffle the order of the terminal_widget_match_add calls around and see what happens...
Comment 6 Teppo Turtiainen 2007-07-16 18:22:50 UTC
Unique and detailed stack trace. Also reproduceable on Ubuntu Gutsy with Terminal 2.18.1. Confirming.
Comment 7 Behdad Esfahbod 2007-11-27 03:10:59 UTC
Thanks Sitsofe for the analysis.  That's exactly what was happening.

2007-11-26  Behdad Esfahbod  <behdad@gnome.org>

        Bug 441618 – Message-ID/news-Link crashes gnome-terminal

        * src/terminal-widget-vte.c (terminal_widget_check_match),
        (terminal_widget_skey_check_match): Return flavor as flavor,
        not tag as flavor.