Bug 174002 - Merging with Directory resource fails to merge in filesystem
Summary: Merging with Directory resource fails to merge in filesystem
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kab3
Classification: Miscellaneous
Component: general (show other bugs)
Version: 3.5
Platform: Fedora RPMs Unspecified
: NOR normal
Target Milestone: ---
Assignee: Tobias Koenig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-31 22:55 UTC by Juha Tuomala
Modified: 2009-08-05 16:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juha Tuomala 2008-10-31 22:55:51 UTC
Version:            (using KDE 4.1.2)
Installed from:    Fedora RPMs

I added Directory resource to kaddressbook and gave a empty dir for it.

Activated only the new and empty resource.

Added John Doe into addressbook.

Added second John Doe to same addressbook.

Selected both of them, then chose Edit->Merge contacts.

On screen, contacts get merged. On filesystem directory, the two files still exist and after restarting the kaddressbook, the both entries are back.

This looks very much like closed bug #96803.
Comment 1 Juha Tuomala 2008-10-31 22:57:30 UTC
Note that Fedora 9 runs KDE 4.1.2, but kdepim3 and this kaddressbook shows 3.5.10 as version. This box is x86_64.
Comment 2 Tobias Koenig 2008-11-02 11:04:06 UTC
Hej Juha,

I can't reproduce that behaviour, neither in KDE 3.5.10 nor in KDE trunk.
After merging these two entries, only one entry shows up in the view and
in the directory only one file is present.
Comment 3 Kevin Kofler 2008-11-02 16:08:37 UTC
I don't see this behavior, but I can't delete the contact, it keeps coming back when I restart KAddressBook.
Comment 4 Kevin Kofler 2008-11-02 16:09:33 UTC
(The contact I can't delete is the contact created by merging the 2 contacts as in the instructions for reproducing this bug.)
Comment 5 Kevin Kofler 2008-11-02 16:19:13 UTC
Actually, the deleting bug was with the default file resource, looks like there's a separate bug there.

I tried creating a directory resource now, but I can't reproduce the bug with that either, merging works correctly here.
Comment 6 Juha Tuomala 2008-11-02 16:48:09 UTC
irc discussion revealed that:
> If there is only one contact in kaddressbook you can't 
> because we can't differ whether the user wants to delete 
> the last contact or whether his address book has vanished... 
> so we restore the last version

something essential to know if others are trying this out.
btw, I've NFS home dir which sometimes gives fishy symptoms.
Comment 7 Kevin Kofler 2008-11-02 16:51:29 UTC
IMHO that is definitely a bug, some solution is needed. Not being able to empty out the address book (without resorting to deleting the offending files (std.vcf and several backups), which is what I did to fix the problem) sucks. But it is not the same as the original bug (the issue with merging 2 entries), which is not explained by this explanation.
Comment 8 Juha Tuomala 2008-11-02 21:36:36 UTC
Like in bug #129560 I did other set of tests with non-NFS directory
when the problem disappeared, merging works now as expected.

> # mount |grep home
> server:/srv/home on /home type nfs (rw,addr=172.16.1.1)

server is Centos5. Locking is working.

Also noticed that added entry is saved into filesystem immediately
when the Ok button is pressed from the edit dialog, even the 'Save'
toolbar button remains non-dim/gray. Thus pressing it doesn't really
change anything anymore, except making it dim again. But that's a 
minor issue, even being bug itself too.
Comment 9 Juha Tuomala 2008-11-03 10:35:01 UTC
comment #8:
> the problem disappeared, merging works now as expected.

nope, that was too early report, still it does not merge
on filesystem. I've tons of duplicates and no way to get rid of
them as it does not actually merge them.
Comment 10 Juha Tuomala 2009-02-26 14:23:16 UTC
Okay, now it looks like i've hint what causes this:

BEGIN:VCARD
CLASS:PUBLIC
FN:aaa
N:aaa;;;;
NAME:aaa
REV:2009-02-26T15:12:50
UID:D6I0lmf7ui
VERSION:3.0
END:VCARD


BEGIN:VCARD
CLASS:PUBLIC
EMAIL:b
FN:aaa
N:aaa;;;;
NAME:aaa
REV:2009-02-26T15:13:05
UID:sRhpsRm8GT
VERSION:3.0
END:VCARD

Merging these two works fine. But following cards miss UID field
which in kmail Directory resource is the same as the file name.


BEGIN:VCARD
CLASS:PUBLIC
EMAIL:b
FN:aaa
N:aaa;;;;
NAME:aaa
REV:2009-02-26T15:14:20
VERSION:3.0
END:VCARD


BEGIN:VCARD
CLASS:PUBLIC
EMAIL:bb
FN:aaa
N:aaa;;;;
NAME:aaa
VERSION:3.0
END:VCARD

Attempting to merge them causes:
$ grep aaa *|cut -d: -f1 |uniq
8SVZK0vf8Q
D6I0lmf7ui
yBzPVsGAZd
$

So, the file name and UID is the same string. If that is not inside the VCARD, it fails to merge the entries - even they disappear from the running GUI. Restarting the kaddresbook shows them again, and it appears that it may actually duplicate them even more, in this case to three entries.

I'm not sure is the UID mandatory in VCARD 2.1/3.0 versions. I seem to have both versions in my resource dir. Anyway, storing the UID into file name and internally to file sounds duplicate and prone for problems.

I got these troublesome VCARDs from Nokia phone when I synced them with opensync cli tool osynctool. Opensync's 'file-sync' plugin is basically the same as kdepim's directory resource, the naming is just conflicting.

Is there any change to do something about this? I know that I should not sync directly these files without locks and all, but at this point I'm not that picky with such details.
Comment 11 Juha Tuomala 2009-02-26 14:24:49 UTC
This is now fedora 10, kde 4.2.00, kdepim4.
Comment 12 Juha Tuomala 2009-02-26 14:39:35 UTC
http://www.ietf.org/rfc/rfc2426.txt  Chapter 1.
> Profile special notes: The vCard object MUST contain 
> the FN, N and VERSION types.

Which sounds that UID is not mandatory for VCard 3.0.
Comment 13 Tobias Koenig 2009-08-05 16:38:47 UTC
The development of the old KAddressBook will be discontinued for KDE 4.4.
Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.