GNOME Bugzilla – Bug 569113
calendar popup crashes on platform with 64-bit time_t
Last modified: 2009-08-11 18:55:18 UTC
Steps to reproduce: 1. on NetBSD-current/i386 (where time_t is 64-bit) 2. have some holiday calendar active 3. click in clock to get calendar popup Stack trace: Other information: Callback confuses time_t and GTime (likely works on native 64-bit platforms because ABI passes 32-bit argument in 64-bit registers). $NetBSD: patch-ab,v 1.5 2009/01/25 17:03:31 drochner Exp $ --- applets/clock/calendar-client.c.orig 2009-01-13 01:02:20.000000000 +0100 +++ applets/clock/calendar-client.c @@ -909,8 +909,8 @@ resolve_timezone_id (const char *tzid, static gboolean calendar_appointment_collect_occurrence (ECalComponent *component, - GTime occurrence_start, - GTime occurrence_end, + time_t occurrence_start, + time_t occurrence_end, GSList **collect_loc) { CalendarOccurrence *occurrence;
Created attachment 128999 [details] [review] patch to calendar-client.c Attaching the patch the right way. (slightly modified from the original one to avoid a typecast so that the compiler has a chance to detect the mismatch)
Matthias: indeed better to attach it as a patch. We might have other similar issues. Can you quickly check that we can safely change all the GTime to time_t in the clock applet?
> We might have other similar issues Yes, but the other uses of GTime just lead to silent truncation of time_values to longs, ie. Y2037 issues, not to crashes. > Can you quickly check that we can safely > change all the GTime to time_t in the clock applet? A little bit more is needed -- the gtk_tree_model uses G_TYPE_LONG for times. Since there is no G_TYPE for time_t we need to use the widest possible type (which is INT64) and do explicit conversions so that it works for both 32 and 64-bit time_t. I'll attach a patch which does all this, it is lightly tested on NetBSD-current/i386. (With a little change to e-d-s which removes an arbitrary limitation for recurring events to be valid until 2037 only I can page beyond 2037 and still get the holidays displayed. Actually only the fixed ones - easter date etc doesn't work but I didn't check yet whether this uses a formula or just a limited table.)
Created attachment 130104 [details] [review] use time_t instead of GTime
Thanks!