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 656207 - e_cal_client_get_object_sync() does not work correctly if RID is NULL
e_cal_client_get_object_sync() does not work correctly if RID is NULL
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Calendar
3.2.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2011-08-09 12:05 UTC by Christophe Dumez
Modified: 2013-09-14 16:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch for MASTER (1.14 KB, patch)
2011-08-09 12:25 UTC, Christophe Dumez
accepted-commit_now Details | Review

Description Christophe Dumez 2011-08-09 12:05:51 UTC
If I call e_cal_client_get_object_sync(client, "20080407T193125Z-19554-727-1-50@gollum", NULL, &comp, NULL, &gerror), I get the following result:
***
BEGIN:VCALENDAR
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
VERSION:2.0
BEGIN:VEVENT
UID:20080407T193125Z-19554-727-1-50@gollum
DTSTAMP:20080407T193125Z
DTSTART:20080413T090000Z
DTEND:20080413T093000Z
TRANSP:OPAQUE
SEQUENCE:7
SUMMARY:Recurring: Modified
CLASS:PUBLIC
CREATED:20080407T193241
LAST-MODIFIED:20080407T193647
RECURRENCE-ID:20080413T090000Z
DESCRIPTION:second instance modified
END:VEVENT
END:VCALENDAR
***

Instead of:

***
BEGIN:VCALENDAR
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
VERSION:2.0
BEGIN:VEVENT
UID:20080407T193125Z-19554-727-1-50@gollum
DTSTAMP:20080407T193125Z
DTSTART:20080406T090000Z
DTEND:20080406T093000Z
TRANSP:OPAQUE
SEQUENCE:2
SUMMARY:Recurring
DESCRIPTION:recurs each Sonday\, 10 times
CLASS:PUBLIC
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=SU;UNTIL=20080608T090000Z
CREATED:20080407T193241
LAST-MODIFIED:20080407T193241
END:VEVENT
END:VCALENDAR
***

It returns an instance instead of returning the parent. I'm not able to reproduce the issue by using the deprecated ecal API (e_cal_get_object).

I compared the code for e_cal_client_get_object_sync() and e_cal_get_object() and I found the following difference:

e_cal_client_get_object_sync() is calling complete_get_object_master() which does:

***
} else if (res && icalcomponent_isa (tmp_comp) == ICAL_VCALENDAR_COMPONENT) {
                                // XXX: Why this loop?
                                for (master_comp = icalcomponent_get_first_component (tmp_comp, kind);
                                     master_comp;
                                     master_comp = icalcomponent_get_next_component (tmp_comp, kind)) {
                                        if (!icalcomponent_get_uid (master_comp))
                                                continue;

                                        if (icaltime_is_valid_time (icalcomponent_get_recurrenceid (master_comp)) &&
                                            !icaltime_is_null_time (icalcomponent_get_recurrenceid (master_comp)))
                                                break;
                                }

                                if (!master_comp)
                                        master_comp = icalcomponent_get_first_component (tmp_comp, kind);

                                *icalcomp = master_comp ? icalcomponent_new_clone (master_comp) : NULL;
                        }
***

The equivalent in e_cal_get_object() does not have the for loop and calls icalcomponent_get_first_component() directly. If I comment the for loop, the method returns the expected result.

In the for loop, it appears we are making sure that master_comp has a recurrence ID but I don't think this is correct when the client asks for a parent (with RID == NULL).
Comment 1 Christophe Dumez 2011-08-09 12:25:59 UTC
Created attachment 193484 [details] [review]
Proposed patch for MASTER
Comment 2 Milan Crha 2011-08-09 12:29:53 UTC
Thanks for the finding, I did this wrong. I would check for valid times first, and then for null times, but this will work too. Please commit to master.