Re: [Evolution-hackers] Evolution requesting info on every year from 2011 down to 65535

2011-02-21 Thread Carlos Martín Nieto
On Tue, 2011-02-22 at 11:30 +1300, Andrew McMillan wrote:
> [...]
> Hi Carlos,
> 
> From RFC5545:
> 
>   The INTERVAL rule part contains a positive integer representing at
>   which intervals the recurrence rule repeats.  The default value is
>   "1", meaning every second for a SECONDLY rule, every minute for a
>   MINUTELY rule, every hour for an HOURLY rule, every day for a
>   DAILY rule, every week for a WEEKLY rule, every month for a
>   MONTHLY rule, and every year for a YEARLY rule.  For example,
>   within a DAILY rule, a value of "8" means every eight days.
> 
> So yes: 0 is also invalid, as you would expect :-)

 A very reasonable thing for the RFC to say :) This should probably be
done in libical, but within e-d-s it the following patch probably makes
more sense than the one I posted on the other thread ("Deal with
negative intervals")

[PATCH] ECalRecur: Convert negative intervals into the default (1)

Negative intervals have been spotted in the wild. An interval lower
than 1 doesn't make any sense, so if we see one, we replace it by the
default iCal interval of 1.
---
 calendar/libecal/e-cal-recur.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/calendar/libecal/e-cal-recur.c b/calendar/libecal/e-cal-recur.c
index 3c30618..9eda66a 100644
--- a/calendar/libecal/e-cal-recur.c
+++ b/calendar/libecal/e-cal-recur.c
@@ -996,7 +996,8 @@ e_cal_recur_from_icalproperty (icalproperty *prop, gboolean 
exception,
ir = icalproperty_get_rrule (prop);
 
r->freq = ir.freq;
-   r->interval = ir.interval;
+   /* Interval < 1 doesn't make sense, so use the default. */
+   r->interval = ir.interval < 1 ? 1 : ir.interval;
 
   r->enddate = e_cal_recur_obtain_enddate (&ir, prop, zone, convert_end_date);

-- 
Carlos Martín Nietohttp://www.cmartin.tk

"¿Cómo voy a decir bobadas si soy mudo?" -- CACHAI


signature.asc
Description: This is a digitally signed message part
___
evolution-hackers mailing list
evolution-hackers@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Evolution requesting info on every year from 2011 down to 65535

2011-02-21 Thread Andrew McMillan
On Mon, 2011-02-21 at 14:08 +0100, Carlos Martín Nieto wrote:
> On Thu, 2011-02-17 at 08:21 +0100, Milan Crha wrote:
> > On Thu, 2011-02-17 at 00:48 +0100, Carlos Martín Nieto wrote:
> > >  I've attached the backtrace for a year of 167 (I think) though I don't
> > > think it gives much information. This happens even if I have my main
> > > calendar off (which I think it's the only one with recurring events).
> > 
> > Hi,
> > this is from your CalDAV calendar, based on the backtrace. Try to get
> > the component which is causing this trouble, and see whether there is
> > something wrong either with that component or with evolution. You can
> > achieve that if you breakpoint as you did earlier, then move to frame
> > of e_cal_backend_sexp_match_comp function and invoke gdb command:
> >(gdb) printf "%s\n", e_cal_component_get_as_string (comp)
> > then strip any private information (the best by replacing with 'x' or
> > similar letter) and maybe share it here, if you think it's correct,
> > or better file a bug report and post here a link to it.
> 
>  I'm not sure whose fault it is, but the
> RRULE:FREQ=WEEKLY;UNTIL=20110219;INTERVAL=-1;BYDAY=WE line looks
> suspicous. I've checked on the Google Calendar and even there it says it
> repeats each -1 weeks :S
> 
>  So I'm going to write up a patch to ignore intervals < 0 (maybe < 1
> better?)

Hi Carlos,

From RFC5545:

  The INTERVAL rule part contains a positive integer representing at
  which intervals the recurrence rule repeats.  The default value is
  "1", meaning every second for a SECONDLY rule, every minute for a
  MINUTELY rule, every hour for an HOURLY rule, every day for a
  DAILY rule, every week for a WEEKLY rule, every month for a
  MONTHLY rule, and every year for a YEARLY rule.  For example,
  within a DAILY rule, a value of "8" means every eight days.

So yes: 0 is also invalid, as you would expect :-)


Cheers,
Andrew.

-- 

andrew (AT) morphoss (DOT) com+64(272)DEBIAN
To be is to program.




signature.asc
Description: This is a digitally signed message part
___
evolution-hackers mailing list
evolution-hackers@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-hackers


[Evolution-hackers] [PATCH][RFC] Deal with negative intervals

2011-02-21 Thread Carlos Martín Nieto
Hi,

 Dealing with the error I posted about on another thread, I found that
Google is giving me some recurring events with an interval of -1, which
causes evo to search for all years from 2011 to -1, when it errors out
because it's no longer a valid time_t (which I guess also explains why
it sometimes seems to stop responding for a bit).

 I'm not sure how I managed to create them, but the Google calendar web
interface manages to display them correctly. As a fix for this
behaviour, I've changed the library to use the absolute value (which
also has the added advantage that these entries are now displayed).

 I can push the change in myself if people are in favour, but I wanted
to ask, as this could be considered quite wrong.

   cmn

---
 calendar/libecal/e-cal-recur.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/calendar/libecal/e-cal-recur.c
b/calendar/libecal/e-cal-recur.c
index 3c30618..87e430c 100644
--- a/calendar/libecal/e-cal-recur.c
+++ b/calendar/libecal/e-cal-recur.c
@@ -996,7 +996,8 @@ e_cal_recur_from_icalproperty (icalproperty *prop,
gboolean exception,
ir = icalproperty_get_rrule (prop);
 
r->freq = ir.freq;
-   r->interval = ir.interval;
+   /* Invervals of -1 have been spotted in the wild (Google) */
+   r->interval = abs(ir.interval);
 
   r->enddate = e_cal_recur_obtain_enddate (&ir, prop, zone,
convert_end_date);

-- 
Carlos Martín Nietohttp://www.cmartin.tk

"¿Cómo voy a decir bobadas si soy mudo?" -- CACHAI


signature.asc
Description: This is a digitally signed message part
___
evolution-hackers mailing list
evolution-hackers@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Evolution requesting info on every year from 2011 down to 65535

2011-02-21 Thread Carlos Martín Nieto
On Thu, 2011-02-17 at 08:21 +0100, Milan Crha wrote:
> On Thu, 2011-02-17 at 00:48 +0100, Carlos Martín Nieto wrote:
> >  I've attached the backtrace for a year of 167 (I think) though I don't
> > think it gives much information. This happens even if I have my main
> > calendar off (which I think it's the only one with recurring events).
> 
>   Hi,
> this is from your CalDAV calendar, based on the backtrace. Try to get
> the component which is causing this trouble, and see whether there is
> something wrong either with that component or with evolution. You can
> achieve that if you breakpoint as you did earlier, then move to frame
> of e_cal_backend_sexp_match_comp function and invoke gdb command:
>(gdb) printf "%s\n", e_cal_component_get_as_string (comp)
> then strip any private information (the best by replacing with 'x' or
> similar letter) and maybe share it here, if you think it's correct,
> or better file a bug report and post here a link to it.

 I'm not sure whose fault it is, but the
RRULE:FREQ=WEEKLY;UNTIL=20110219;INTERVAL=-1;BYDAY=WE line looks
suspicous. I've checked on the Google Calendar and even there it says it
repeats each -1 weeks :S

 So I'm going to write up a patch to ignore intervals < 0 (maybe < 1
better?)

   cmn
-- 
Carlos Martín Nietohttp://www.cmartin.tk

"¿Cómo voy a decir bobadas si soy mudo?" -- CACHAI


signature.asc
Description: This is a digitally signed message part
___
evolution-hackers mailing list
evolution-hackers@gnome.org
To change your list options or unsubscribe, visit ...
http://mail.gnome.org/mailman/listinfo/evolution-hackers