Bug 1226823

Summary: [abrt] gnome-calendar: ____strtol_l_internal(): gnome-calendar killed by SIGSEGV
Product: [Fedora] Fedora Reporter: Mathieu Bridon <bochecha>
Component: gnome-calendarAssignee: Igor Gnatenko <ignatenko>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: gnome-sig, ignatenko
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/6498726cb68e153c605170c7ff3c72897d8a7d26
Whiteboard: abrt_hash:c0725865f596051d39b6015670d5617ef3c7ed2b
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-28 12:48:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cgroup
none
File: core_backtrace
none
File: dso_list
none
File: environ
none
File: limits
none
File: maps
none
File: mountinfo
none
File: namespaces
none
File: open_fds
none
File: proc_pid_status
none
File: var_log_messages
none
Screenshot of the date editing dialog none

Description Mathieu Bridon 2015-06-01 08:43:06 UTC
Description of problem:
I'm trying to add an event on the 8th of June.

There already is an event on that day in my calendar.

Start date is the 8th of June. By default end date is marked as being the 9th of June, but I try to change that to the 8th as it's a short event.

When I click on the calendar widget to select the 8th of June, GNOME Calendar crashes.

Version-Release number of selected component:
gnome-calendar-3.16.2-1.fc22

Additional info:
reporter:       libreport-2.5.1
backtrace_rating: 4
cmdline:        /usr/bin/gnome-calendar --gapplication-service
crash_function: ____strtol_l_internal
executable:     /usr/bin/gnome-calendar
global_pid:     32536
kernel:         4.0.4-301.fc22.x86_64
runlevel:       N 5
type:           CCpp
uid:            1000

Truncated backtrace:
Thread no. 1 (10 frames)
 #0 ____strtol_l_internal at ../stdlib/strtol_l.c:297
 #1 __strtol at ../stdlib/strtol.c:109
 #2 atoi at /usr/include/stdlib.h:280
 #3 parse_entries at gcal-date-selector.c:135
 #4 date_entry_focus_out at gcal-date-selector.c:114
 #5 _gtk_marshal_BOOLEAN__BOXED at gtkmarshalers.c:85
 #10 gtk_widget_event_internal at gtkwidget.c:7787
 #11 gtk_widget_send_focus_change at gtkwidget.c:16160
 #12 do_focus_change at gtkwindow.c:7943
 #13 gtk_window_real_set_focus at gtkwindow.c:8229

Comment 1 Mathieu Bridon 2015-06-01 08:43:09 UTC
Created attachment 1033209 [details]
File: backtrace

Comment 2 Mathieu Bridon 2015-06-01 08:43:10 UTC
Created attachment 1033210 [details]
File: cgroup

Comment 3 Mathieu Bridon 2015-06-01 08:43:12 UTC
Created attachment 1033211 [details]
File: core_backtrace

Comment 4 Mathieu Bridon 2015-06-01 08:43:13 UTC
Created attachment 1033212 [details]
File: dso_list

Comment 5 Mathieu Bridon 2015-06-01 08:43:14 UTC
Created attachment 1033213 [details]
File: environ

Comment 6 Mathieu Bridon 2015-06-01 08:43:16 UTC
Created attachment 1033214 [details]
File: limits

Comment 7 Mathieu Bridon 2015-06-01 08:43:17 UTC
Created attachment 1033215 [details]
File: maps

Comment 8 Mathieu Bridon 2015-06-01 08:43:18 UTC
Created attachment 1033216 [details]
File: mountinfo

Comment 9 Mathieu Bridon 2015-06-01 08:43:20 UTC
Created attachment 1033217 [details]
File: namespaces

Comment 10 Mathieu Bridon 2015-06-01 08:43:21 UTC
Created attachment 1033218 [details]
File: open_fds

Comment 11 Mathieu Bridon 2015-06-01 08:43:22 UTC
Created attachment 1033219 [details]
File: proc_pid_status

Comment 12 Mathieu Bridon 2015-06-01 08:43:23 UTC
Created attachment 1033220 [details]
File: var_log_messages

Comment 13 Mathieu Bridon 2015-06-01 14:30:57 UTC
So the crash happens at line 135 of the src/gcal-date-selector.c file:

    static void
    parse_entries (GcalDateSelector *selector)
    {
      [... snip ...]
      day = atoi (gtk_entry_get_text (GTK_ENTRY (priv->entries[DAY])));
      month = atoi (gtk_entry_get_text (GTK_ENTRY (priv->entries[MONTH])));
      year = atoi (gtk_entry_get_text (GTK_ENTRY (priv->entries[YEAR])));
      [... snip ...]
    }

That's the "year = ..." line above.

I've set a breakpoint on that line with gdb, and here's what I get:

    (gdb) p priv->entries[YEAR]
    $4 = 0x0
    (gdb) p priv->entries[MONTH]
    $5 = 0x9bb200 [GtkEntry]
    (gdb) p priv->entries[DAY]
    $6 = 0x9bb440 [GtkEntry]

So the year entry is pointing to NULL, which doesn't seem like the expected value. :)

Comment 14 Mathieu Bridon 2015-06-01 14:52:11 UTC
Created attachment 1033378 [details]
Screenshot of the date editing dialog

This is a screenshot of the dialog I get when trying to add an event to my calendar.

Clearly, you can see that the year entry is empty.

This is what causes the crash, as soon as I do anything that closes the date-picker. (for example, select a date, or just click anywhere outside the date picker)

My locale is en_HK.utf8.

If I run GNOME Calendar as follows:

  $ LC_TIME=C gnome-calendar

Then everything works as expected. Same with:

  $ LC_TIME=en_US.utf8 gnome-calendar

However, with the en_HK.utf8 locale:

  $ LC_TIME=en_HK.utf8 gnome-calendar
  
  (gnome-calendar:8055): Gtk-CRITICAL **: gtk_label_set_text: assertion 'GTK_IS_LABEL (label)' failed
  
  (gnome-calendar:8055): Gtk-CRITICAL **: gtk_label_set_text: assertion 'GTK_IS_LABEL (label)' failed
  
  (gnome-calendar:8055): Gtk-CRITICAL **: gtk_entry_set_text: assertion 'GTK_IS_ENTRY (entry)' failed
  
  (gnome-calendar:8055): Gtk-CRITICAL **: gtk_entry_set_text: assertion 'GTK_IS_ENTRY (entry)' failed

Those critical warnings show up with this locale, indicating that something is wrong with some labels/entries, and then eventually, I get the attached screenshot, and the crash.

Comment 15 Mathieu Bridon 2015-06-01 15:10:04 UTC
So here's what I think is happening.

At gcal-date-selector.c:236 there is this line:

  priv->mask = nl_langinfo (D_FMT);

When running with LC_TIME=C, priv->mask will point to the "%m/%d/%y" string.

The rest of the code in that same function tries to identify the order in which to show the day, month and year widgets for the user locale, based on that date mask.

When running with LC_TIME=C, that will end up being:

  (gdb) p priv->month_pos
  $1 = 0
  (gdb) p priv->day_pos
  $2 = 1
  (gdb) p priv->year_pos
  $3 = 2

When showing the entry widgets, the entry 0 will thus contain the month, the entry 1 will contain the day, and the entry 2 will contain the year.

However, when running with LC_TIME=en_HK.utf8, priv-mask will point to the "%A, %B %d, %Y" string.

As a result, we get:

  (gdb) p priv->month_pos
  $1 = 1
  (gdb) p priv->day_pos
  $2 = 2
  (gdb) p priv->year_pos
  $3 = 3

This is because there are two identifiers for the day in this locale (%A and %d), which bumps all values off by one.

When showing the entry widgets, the entry 0 will thus contain... well, nothing, as can be seen on my screenshot. :)

The entry 1 will contain the month, entry 2 the day.

And there's no entry for the year, because entries are only 0, 1 and 2, not 3, which explains why priv->entries[YEAR] is NULL, as shown in comment 13.

Comment 16 Igor Gnatenko 2016-06-28 12:48:47 UTC
Closing this issue as it is old. If you still think that it exists - reopen please. Thanks!