Bug 60691 - KPilot vcal conduit changes day when syncing repeating events
Summary: KPilot vcal conduit changes day when syncing repeating events
Status: RESOLVED FIXED
Alias: None
Product: kpilot
Classification: Applications
Component: Calendar Conduit (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR major
Target Milestone: ---
Assignee: Douglas Harms
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-03 15:01 UTC by Dan Mareck
Modified: 2009-02-10 00:46 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposed patch to fix recurrence problems with monthly-by-day-and-week (1.25 KB, patch)
2008-04-20 00:16 UTC, Tomi Junnila
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Mareck 2003-07-03 15:01:46 UTC
Version:            (using KDE 3.1.2)
Installed from:     (testing/unstable)
Compiler:          gcc version 3.3 (Debian)
OS:          Linux (i586) release 2.4.18-bf2.4

When a repeating event is created in KOrganizer, then sync'd with the Palm, the event on the palm is moved ahead by one day.  

For example, an event created in KOrganizer for the 1st Wednesday of the month will be placed on the Palm as an event on the 1st Tuesday.  Ultimately, after multiple syncs there will be two events in KOrganizer, one on the 1st Wednesday, the other on the 1st Tuesday.  Oddly enough if either of these events are deleted, both are removed (when "delete all" is pressed). The Palm will only have the 1st Tuesday event.  To recreate this bug do the following:

1. In KOrganizer, create an event on the 1st Wednesday of the month.
  A. Start time 7:00, end 9:00
  B. Make event that repeats 1st Wednesday of every Month 
  C. Save the KOrganizer file and exit KOrganizer.
2. Use KPilot to perform a hotsync with the Palm
3. Using the Palm Datebook application you'll see the event occuring on the 1st Tuesday.
4. Use KPilot to hotsync again.
5. Open KOrganizer and you will see a second event occuring on the 1st Tuesday.

The bug occurs in the opposite direction as well.  When a repeating event is created on the Palm, it transfers correcty to KOrganizer during the first sync.

When the palm is sync'd again with the PC, the palm event is again moved one day ahead, and the original on the Palm
is removed.  To recreate this bug do the following:

1. On the Palm, create an event on the 1st Wednesday of the month.
  A. Start time 7:00, end 9:00
  B. Make event repeat 1st Wednesday of every month.
2. Use KPilot to perform a hotsync with the Palm
3. Open KOrganizer and examine the 1st Wednesday of each month.
4. Close KOrganizer
5. Use KPilot to sync with the Palm again
6. Examine the Palm and you will see that the event has been moved to the 1st Tuesday of the month.

I have performed these experiments with "ending dates" and ending after "number of times" with the same results.  The frequency of the event has no effect as well.
Comment 1 groot 2003-07-04 00:28:37 UTC
Subject: Re:  New: KPilot vcal conduit changes day when syncing repeating events

On Thursday 03 July 2003 15:01, you wrote:
> When a repeating event is created in KOrganizer, then sync'd with the Palm,
> the event on the palm is moved ahead by one day.

This is a duplicate, though I can't think of of what right now. We had this 
problem a long time back and as far as I know Reinhold fixed it.

Comment 2 Dan Mareck 2003-07-08 19:53:46 UTC
When I searched the Bug database before posting this potential bug, I found  
21816 which was the same and 24291 which was similar.  Both of these were 
reported fixed and closed in 2001.  I found this problem in KPilot 
4.3.10(BRANCH), pilot-link 0.11.7., which are part of KDE 3.1.1 (or 2?) 
Comment 3 Reinhold Kainhofer 2003-07-08 22:59:20 UTC
Yes, you are the second one to report this behavior in a recent version. That's the 
reason I didn't close it (didn't comment on it either, though. I still have to investigate 
this). I haven't tested anything, but your bug report fortunately gives good examples to 
check it.  
Comment 4 Reiner Nix 2003-07-11 08:51:10 UTC
I can confirm this: A repeating appointment at the 2. sunday every month starting on 13.7.2003 was moved to start on 14.9.2003. And another occurence: A repeating appointment at the 4. sunday every month was moved toanother day. An phantom duplicate was inserted with enabled alarm.My configuration is slightly different:Linux kernel 2.4.16 on Debian WoodyKDE 3.1.2Qt 3.1.2pilot-link 0.11.7KPilot 4.3.10 (BRANCH)Palm device: Sony Clie PEG SJ22/EPalm Desktop 4.1Konduits.KDE address book: pilot has preference over PC, full syncKOrgangizer: Only Pilot to PC, sync archive, pilot has preference over PC
Comment 5 Reinhold Kainhofer 2003-07-31 01:20:59 UTC
Subject: kdepim/kpilot/conduits/vcalconduit

CVS commit by kainhofe: 

Fixed bug #60691 where events recurring monthly on a given weekday were shifted by one day.
Also, when initializing a LocalCalendar, you are not supposed to give a time zone...
Also, fixed infinite loop glitch by Cornelius. 

CCMAIL: 60691-done@bugs.kde.org


  M +4 -2      todo-conduit.cc   1.38
  M +39 -13    vcal-conduit.cc   1.95
  M +3 -2      vcal-conduitbase.cc   1.45



Comment 6 Jason LeBrun 2006-03-01 18:32:38 UTC
I'm still having problems related to this bug. in particular, with Pilot-link 0.11.8-r1 and kpilot in KDE 3.5.1 (Gentoo distribution), I get the following behavior:

1. Create an event in Korganizer: Tues 2/7 at 6:45pm-10pm. Repeating first Tuesday of the month until 6/7/2006. 

2. Sync

3. Event on handheld shows as occuring on the first Weds of every month. 
Comment 7 Jason LeBrun 2006-03-01 18:33:35 UTC
By the way, I'm using a Treo 650. 
Comment 8 Dan Mareck 2006-04-27 17:11:59 UTC
In response to Jason's observations.  This did not happen at all in KDE 3.4.3. I just got around to upgrading to 3.5.2 and I saw this happen one time on a fresh install of KDE 3.5.2.  After that one instance, I have not been able to reproduce it.
Comment 9 Ren Maddox 2006-05-19 01:32:41 UTC
I am having this problem in KDE 3.5.2.
Comment 10 Andreas Feldner 2006-08-22 20:19:18 UTC
I also get this behaviour. It started with KDE 3.5 and is not yet fixed in 3.5.4 (kpilot 4.6.0). The problem is the same on i386 and alpha machines, by the way.
Comment 11 Dan Mareck 2006-08-23 16:40:50 UTC
I suspect that the recurring event date shift may be related to timezone & clock configuration - although I haven't taken the time to fully explore that theory.  I saw this shift one time after I upgraded to KDE 3.5.2. My hardware clock was set to local time and Korganizer had an Eastern Timezone set.  From what I remember, the shift disappeared when I set Korganizer to "No Selection" for timezone.  I hope this observation helps.
Comment 12 Tomi Junnila 2008-04-20 00:16:51 UTC
Created attachment 24419 [details]
Proposed patch to fix recurrence problems with monthly-by-day-and-week

I've looked into this a bit and I think I have the problem solved. I added some
instrumentation to the two setRecurrence functions in vcalconduit.cc (I'm using
korganizer from Ubuntu 7.10, i.e. version 3.5.7, and kpilot from the 3.5 branch
in Subversion, checked out on 2008-04-10), and got the results below.

First, I nuked my calendar contents in KOrganizer (and got a backup of my palm
using pilot-link). I have an event recurring monthly, on the third Wednesday of
each month. The event gets properly synchronized from the Palm to the Kontact
calendar.

However, later on, when the event gets synced back to the Palm, I noted that
the KCal::RecurrenceRule::WDayPos mp (in static void
setRecurrence(PilotDateEntry*dateEntry, const KCal::Event *event)) has:
mp.pos()=3, mp.day()=3. According to recurrencerule.h in libkcal,
WDayPos::day() returns 1 for Monday and 7 for Sunday, and this - I think - is
where the error in vcalRecord.cc is: these are not bit numbers here but day
numbers, and thus the results are already off by one (an annoying inconsistency
in libkcal if you ask me). So we only need to convert 7 to 0 for Sundays, but
we shouldn't add 1 to it before the modulo.

I've attached a proposed patch (svn diff), which seems to work for me at least,
and should be ok if the documentation is ok. :-)
Comment 13 Douglas Harms 2009-02-05 04:48:43 UTC
I'm experiencing the same problem - recurrence problems with monthly-by-day issues.  Tomi's patch works for me.  Has anyone committed this patch yet?

--Doug
Comment 14 Jason 'vanRijn' Kasper 2009-02-05 07:35:22 UTC
Huh. I'm not really sure what's been going on with this bug. My guess is that since it's closed and not assigned to any current KPilot authors, it's not shown up in my radar. Yuckie! Okay, Doug, I'll reopen and assign to you. =:) Thanks for bringing this one to my attention!
Comment 15 Douglas Harms 2009-02-05 15:18:12 UTC
Proposed patch posted for review at:

http://reviewboard.kde.org/r/26/

Please take a look and let me know if this works for you too.
Comment 16 Tomi Junnila 2009-02-05 15:32:32 UTC
Obviously, the patch works for me (both ways), though I'd also test the opposite direction, i.e. adding events on the Palm, and syncing them to korganizer. Also, sync a couple times to see events don't start shifting.
Comment 17 Douglas Harms 2009-02-07 23:31:40 UTC
I posted a revised patch to http://reviewboard.kde.org/r/26/ for review.  I added a bit more handling of recurrences that are defined in korganizer as "from end of month" (e.g., second-from-last thursday each month).  The palm doesn't support this (except for the last day of a month).  The code here does the following mapping:

kcal 2nd from last => palm 3rd
kcal 3rd from last => palm 2nd
kcal 4th from last => palm 1st
kcal 5th from last => palm 1st

The recurrences will be correct during months with 4 occurrence so the day; it will be one week early during months with 5 occurrences of the day.

What does everyone think - is this OK?  I'd like to commit this sometime soon.

Thanks!!

--Doug
Comment 18 Jason 'vanRijn' Kasper 2009-02-08 00:10:31 UTC
That definitely sounds good to me, Doug, especially if you've tested it and made sure it works. =:) At some point in the future, we should be adding these cases to the test cases that we have, but I'm more than willing to get these fixes in and worry about that later. =:)

Thanks!!
Comment 19 Douglas Harms 2009-02-10 00:46:44 UTC
SVN commit 924058 by dharms:

Fixes a problem in kpilot where events that recur on a specific weekday
each month (e.g., 3rd Thursday) were not synced properly.

This also fixes a problem where recurring events specified as a weekday from the
end of the month (e.g., 2nd to the last Wednesday) are handled in a reasonable 
(though not entirely correct) fashion.  (The palm cannot handle events 
specified like this, so this patch attempts to convert the "from end of month"
recurring event to a "from the beginning of month" event.)

BUG:60691


 M  +40 -5     calendarconduit.cc  


WebSVN link: http://websvn.kde.org/?view=rev&revision=924058