Bug 284527

Summary: Error when changing an imap folder's identity (Unknown command SETANNOTATION)
Product: [Frameworks and Libraries] Akonadi Reporter: S. Burmeister <sven.burmeister>
Component: IMAP resourceAssignee: Kevin Ottens <ervin>
Status: RESOLVED FIXED    
Severity: normal CC: alex, arran4, b7.10110111, c.schwarzgruber.cs, christian.lange.81, johannes.hirte, kdepim-bugs, kmm, martin.ruessler, matthias, montel, nick, null, qqqqqqqqq9, vkrause
Priority: NOR    
Version: 4.10   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.3
Sentry Crash Report:

Description S. Burmeister 2011-10-20 09:18:44 UTC
Version:           unspecified (using KDE 4.7.2) 
OS:                Linux

If I open the properties of my gmail inbox and change the identity to be used to some other identity I get an error message which states:

Error writing some annotations for "inbox" on the imap server. SetAnnotation failed, server replied A000049  BAD Unknown command: SETANNOTATION

Reproducible: Always

Steps to Reproduce:
Change the identity of an imap inbox

Actual Results:  
error, see above

Expected Results:  
no error message if its not important or no error if it is a bug
Comment 1 Unknown 2011-11-23 08:21:35 UTC
*** Bug 287261 has been marked as a duplicate of this bug. ***
Comment 2 Nick Leverton 2012-08-29 12:41:15 UTC
This notification is given any time I use the Properties dialogue on an IMAP resource, even if I make no changes or only change a local property (such as the local name).
Comment 3 Nick Leverton 2012-08-29 12:42:46 UTC
Version is 4.9.0, apols for forgetting to say.
Comment 4 Laurent Montel 2012-08-29 12:48:25 UTC
I confirm it
Comment 5 S. Burmeister 2012-08-29 13:08:20 UTC
(In reply to comment #2)
> This notification is given any time I use the Properties dialogue on an IMAP
> resource, even if I make no changes or only change a local property (such as
> the local name).

Indeed, it seems to happen on pretty much any action in the properties dialogue, changing the retrieving options triggers it as well.
Comment 6 S. Burmeister 2012-08-31 22:17:32 UTC
BTW. you get the pop-ups only if you run akonaditray.

Here is the imap log of such a request:

S: A000186 OK Completed
C: A000187 UID STORE 394440 FLAGS (\Seen)
S: * 654 FETCH ( FLAGS (\Seen) UID 394440 )
S: A000187 OK Completed
C: A000188 GETACL "INBOX"
S: * ACL INBOX user@domain.de lrswipcda
S: A000188 OK Completed
C: A000189 MYRIGHTS "INBOX"
S: * MYRIGHTS INBOX lrswipcda
S: A000189 OK Completed
C: A000190 GETQUOTAROOT "INBOX"
S: * QUOTAROOT INBOX user/username@domain.de
S: * QUOTA user/username@domain.de ( STORAGE 33619 102401 )
S: A000190 OK Completed
C: A000191 SETANNOTATION "INBOX" "false" ("value.shared" "")
S: A000191 BAD invalid arguments for SETANNOTATION
Comment 7 Christian 2012-11-10 11:49:11 UTC
This happens to me to. Tried to follow some instructions to circumvent a possible "bug" in cooperation between kmail and googlemail (see http://www.lazyteddy.com/2011/08/kmail-und-gmail-google-mail-via-imap/), and got this message: 

"SetAnnotation failed, server replied:A000884 BAD Unknown command: SETANNOTATION"
Comment 8 Christian 2012-11-10 11:57:39 UTC
(In reply to comment #7)
> This happens to me to. Tried to follow some instructions to circumvent a
> possible "bug" in cooperation between kmail and googlemail (see
> http://www.lazyteddy.com/2011/08/kmail-und-gmail-google-mail-via-imap/), and
> got this message: 
> 
> "SetAnnotation failed, server replied:A000884 BAD Unknown command:
> SETANNOTATION"

forgot to mention: I'm using Kubuntu 12.04 with Kontact 4.8.5.
Comment 9 km 2012-12-24 12:15:42 UTC
I confirm this.
Comment 10 Christux 2013-02-21 21:20:51 UTC
Same for me using KDE 4.10 on openSuSe 12.3 RC1!
Comment 11 qqqqqqqqq9 2013-07-12 11:12:45 UTC
Hi, this seems to be a workaround:

1. Close kontact
2. Start akonadiconsole
3. Choose tab "Browser" and select the folder you want to change
4. select "Folder Properties" from the Button-3-Menu and select the tab "Attributes"
5. Change the value of collectionannotations (double-click) to 
/vendor/kolab/folder-type event.default
/vendor/kolab/folder-type note.default
/vendor/kolab/folder-type contact.default
/vendor/kolab/folder-type task.default
/vendor/kolab/folder-type journal.default
depending on your need.
6. Close akonadiconsole and start kontact
7. Enjoy
Comment 12 Laurent Montel 2013-07-12 11:53:44 UTC
Great if you find a method to workaround it.
It gives me an idea to try to fix it.
Will test it.
Comment 13 qqqqqqqqq9 2013-07-12 12:23:00 UTC
Hi, 
to be more specific, it's a workaround for not being able to change an imap-folde to a groupware folder which gives the same  "BAD Unknown command:
SETANNOTATION" error.
Comment 14 Alexander Maret-Huskinson 2013-08-16 16:55:21 UTC
(In reply to comment #11)
> 5. Change the value of collectionannotations (double-click) to 
> /vendor/kolab/folder-type event.default
> /vendor/kolab/folder-type note.default
> /vendor/kolab/folder-type contact.default
> /vendor/kolab/folder-type task.default
> /vendor/kolab/folder-type journal.default
> depending on your need.

Unfortunately this does not seem to work with 4.11.0. When changing the collectionannotations attribute I get the error message: "Kolab: Parent collection can not contain sub-collections.". All my folders just get ignored and no contacts/events/notes/... are displayed in kontact.

Any idea what's causing this?
Comment 15 Alexander Maret-Huskinson 2013-08-16 18:47:16 UTC
Took me a while playing with the akonadiconsole but I figured it out:

Kolab's Akonadi sub-collections can not be created because the parent collection which is created by the kolab proxy does not have the "inode/directory" content type set. You have to create it manually and then set the inode/directory content type.

In case someone else runs into the same problem:
Within akonadiconsole, you can use the debugger to see which commands are used to create the parent collection. Just paste them into the "Raw Socket" tab (starting from the "0 Login" command), but do not paste the one that fails. You can now use the Browser and add the content type "inode/directory" to the newly created collection. From now on, Kolab will be able to create its collections whenever you add a "collectionannotation" to an IMAP folder.
Comment 16 Johannes Hirte 2013-08-21 16:41:18 UTC
I can confirm this with kdepim-4.11.0 and akonadi-server-1.10.2. The imap-server is a dovecot-2.2.5 if this matters.
Comment 17 Johannes Hirte 2013-08-21 16:42:37 UTC
I've just seen, after renaming, the folder is deleted on the imap-server!
Comment 18 Matthias Heizmann 2013-09-20 14:38:29 UTC
I have the same problem with KDE SC 4.11.1 and akonadi-server-1.10.2-r1

I would like to use Alexanders workaround, but I failed.
As Alexander suggested I had a look at the debugger and saw the following lines (you see them e.g., if you try to add the kolab calendar via korganizer)
0x825880 0 LOGIN "akonadi_kolabproxy_resource" 
akonadi_kolabproxy_resource (0x825880) 0 OK User logged in 
akonadi_kolabproxy_resource (0x825880) 1 CAPABILITY (NOTIFY 2)
akonadi_kolabproxy_resource (0x825880) 1 OK CAPABILITY completed 
akonadi_kolabproxy_resource (0x825880) 2 RESSELECT "akonadi_kolabproxy_resource" 
akonadi_kolabproxy_resource (0x825880) 2 OK akonadi_kolabproxy_resource selected 
... (I omit the succeeding lines, because they are not relevant for my question)

Afterwards I executed the following commands in the "Raw Socket" tab.
0 LOGIN "akonadi_kolabproxy_resource" 
1 CAPABILITY (NOTIFY 2)
2 RESSELECT "akonadi_kolabproxy_resource" 

However, now I got a different output (last line is different)
0x87a0e0 0 LOGIN "akonadi_kolabproxy_resource" 
akonadi_kolabproxy_resource (0x87a0e0) 0 OK User logged in 
akonadi_kolabproxy_resource (0x87a0e0) 1 CAPABILITY (NOTIFY 2) 
akonadi_kolabproxy_resource (0x87a0e0) 1 OK CAPABILITY completed 
akonadi_kolabproxy_resource (0x87a0e0) 2 RESSELECT "akonadi_kolabproxy_resource" 
akonadi_kolabproxy_resource (0x87a0e0) 2 NO akonadi_kolabproxy_resource is not a valid resource identifier 

What can I do to add the parent collection and set its content type "inode/directory"?
Comment 19 Matthias Heizmann 2013-09-30 00:05:06 UTC
Thank to some help of Alexander I was able to use his workaround.
A few comments for others that run into the same problem.
While creating the kolab ressource manually using the "Raw Socket"
- you have to have the ressource already created in the usual way (I deleted it after I reading the debugging output)
- do not paste the ROLLBACK command, but paste COMMIT instead
- do not reboot after these steps, otherwise the kolab ressource is gone again.

You set the content type to "inode/directory" in
Folder Properties > Internals
(Yes, where it says "Do not even think about chaning anything in here!")
Comment 20 Daniel Vrátil 2013-10-24 16:17:48 UTC
Git commit c215c5a3a55e59d48637de48804aaed416d04a69 by Dan Vrátil.
Committed on 24/10/2013 at 16:14.
Pushed by dvratil into branch 'KDE/4.11'.

Don't update annotations when server does not support it

Don't try to update annotations when server does not have METADATA or
ANNOTATEMORE capability.

Fixes a warning shown when user changed something in Folder properties
in KMail
FIXED-IN: 4.11.3

M  +3    -2    resources/imap/addcollectiontask.cpp
M  +1    -1    resources/imap/changecollectiontask.cpp
M  +7    -0    resources/imap/resourcetask.cpp
M  +2    -0    resources/imap/resourcetask.h
M  +24   -3    resources/imap/tests/testchangecollectiontask.cpp

http://commits.kde.org/kdepim-runtime/c215c5a3a55e59d48637de48804aaed416d04a69