Bug 1287073

Summary: [abrt] gnome-calendar: discover_sources_cb(): gnome-calendar killed by SIGSEGV
Product: [Fedora] Fedora Reporter: madstitz
Component: evolution-data-serverAssignee: Milan Crha <mcrha>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 30CC: caillon+fedoraproject, gnome-sig, ignatenko, jan.public, john.j5live, mcatanzaro+wrong-account-do-not-cc, mcrha, rhughes, rstrode, sandmann
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/b1d514c31cdf9dbcd7adb775ed1c6eb7e31653eb
Whiteboard: abrt_hash:c5cdc45888ea42adf1b329b3aff0f0545107e69c;VARIANT_ID=workstation;
Fixed In Version: evolution-data-server-3.33.90 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-16 07:02:17 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: exploitable
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

Description madstitz 2015-12-01 12:48:00 UTC
Description of problem:
trying to add a new caldav calendar, while typing the address.

Version-Release number of selected component:
gnome-calendar-3.18.1-1.fc23

Additional info:
reporter:       libreport-2.6.3
backtrace_rating: 4
cmdline:        /usr/bin/gnome-calendar --gapplication-service
crash_function: discover_sources_cb
executable:     /usr/bin/gnome-calendar
global_pid:     7826
kernel:         4.2.6-301.fc23.x86_64
runlevel:       N 5
type:           CCpp
uid:            1000

Truncated backtrace:
Thread no. 1 (10 frames)
 #0 discover_sources_cb at gcal-source-dialog.c:1515
 #1 g_task_return_now at gtask.c:1106
 #2 complete_in_idle_cb at gtask.c:1120
 #7 gtk_dialog_run at gtkdialog.c:1395
 #8 _g_closure_invoke_va at gclosure.c:864
 #11 gtk_button_do_release at gtkbutton.c:1899
 #12 gtk_real_button_released at gtkbutton.c:2017
 #17 multipress_released_cb at gtkbutton.c:613
 #18 ffi_call_unix64 at ../src/x86/unix64.S:76
 #19 ffi_call at ../src/x86/ffi64.c:525

Comment 1 madstitz 2015-12-01 12:48:05 UTC
Created attachment 1100900 [details]
File: backtrace

Comment 2 madstitz 2015-12-01 12:48:07 UTC
Created attachment 1100901 [details]
File: cgroup

Comment 3 madstitz 2015-12-01 12:48:08 UTC
Created attachment 1100902 [details]
File: core_backtrace

Comment 4 madstitz 2015-12-01 12:48:10 UTC
Created attachment 1100903 [details]
File: dso_list

Comment 5 madstitz 2015-12-01 12:48:12 UTC
Created attachment 1100904 [details]
File: environ

Comment 6 madstitz 2015-12-01 12:48:13 UTC
Created attachment 1100905 [details]
File: exploitable

Comment 7 madstitz 2015-12-01 12:48:15 UTC
Created attachment 1100906 [details]
File: limits

Comment 8 madstitz 2015-12-01 12:48:17 UTC
Created attachment 1100907 [details]
File: maps

Comment 9 madstitz 2015-12-01 12:48:19 UTC
Created attachment 1100908 [details]
File: mountinfo

Comment 10 madstitz 2015-12-01 12:48:20 UTC
Created attachment 1100909 [details]
File: namespaces

Comment 11 madstitz 2015-12-01 12:48:22 UTC
Created attachment 1100910 [details]
File: open_fds

Comment 12 madstitz 2015-12-01 12:48:23 UTC
Created attachment 1100911 [details]
File: proc_pid_status

Comment 13 madstitz 2015-12-01 12:48:24 UTC
Created attachment 1100912 [details]
File: var_log_messages

Comment 14 Igor Gnatenko 2016-07-07 09:12:08 UTC
This is very old bug, if you still can reproduce it - please reopen.

Comment 15 Jan Vlug 2019-06-08 09:58:49 UTC
Bug 1718519 has been automatically marked as a potential duplicate.

Comment 16 Michael Catanzaro 2019-07-15 19:06:56 UTC
*** Bug 1718519 has been marked as a duplicate of this bug. ***

Comment 17 Michael Catanzaro 2019-07-15 19:11:47 UTC
Updated backtrace from bug #1719519:

 #0 discover_sources_cb at ../src/gcal-source-dialog.c:1545
 #1 g_task_return_now at ../gio/gtask.c:1209
 #2 complete_in_idle_cb at ../gio/gtask.c:1223
 #7 g_main_context_iteration at ../glib/gmain.c:3988
 #8 g_application_run at ../gio/gapplication.c:2516

The crash is here:

          g_debug ("[source-dialog] error: %s", error->message);

Full backtrace indicates:

Thread 1 (Thread 0x7ffa917bd6c0 (LWP 25015)):
#0  discover_sources_cb (source=0x7ffa5404aa00, result=0x7ffa80003d60, user_data=user_data@entry=0x559d0c7c8410) at ../src/gcal-source-dialog.c:1545
        self = 0x559d0c7c8410
        discovered_sources = 0x0
        user_addresses = 0x0
        aux = <optimized out>
        error = 0x0

Amazingly, it doesn't look like a gnome-calendar bug. e_webdav_discover_sources_finish() has returned FALSE without setting the error parameter. GNOME/GLib convention is that applications may assume the error is NULL and dereference it without checking. evolution-data-server should ensure there's always some error when it returns FALSE.

This could still be gnome-calendar's fault if it's passing an invalid ESource, but I don't think that's happening here. -> evolution-data-server

Comment 18 Milan Crha 2019-07-16 07:02:17 UTC
> This could still be gnome-calendar's fault if it's
> passing an invalid ESource, but I don't think that's
> happening here.

You are right, gnome-calendar passes correct ESource, the problem here is in evolution-data-server. Actually two problems:
a) the discovery succeeds on the collection URL (as described by the user in bug #1718519), but the Google server doesn't have /.well-known/cardav/, on which it returns an error, which overrode the success state from the previous command;
b) passing a collection URL which can be part of the result and filtering output of the function only to that certain type did not include this collection in the result set, thus gnome-calendar showed an empty result, instead of the user's calendar.

I fixed both things upstream [1] for 3.33.90+.

I'd say that gnome-calendar should be made more robust too, it's easy to 'error ? error->message : "Unknown error"', especially in debug output, to make sure that programmer's error won't cause crashes on the user's side, but it's up to the (upstream) maintainer to decide.

[1] https://gitlab.gnome.org/GNOME/evolution-data-server/commit/e771a4fb8