Bug 3986

Summary: IMAP quick search using non-ASCII characters creates an infinite loop
Product: Claws Mail (GTK 2) Reporter: George <removed-gdpr>
Component: QuickSearchAssignee: users
Status: RESOLVED FIXED    
Severity: normal CC: simon.legner
Priority: P3    
Version: 3.16.0   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
network log
none
Handle IMAP search failure instead of ignoring it none

Description George 2018-03-14 10:38:01 UTC
Created attachment 1856 [details]
network log

STR:

1. Open an IMAP folder containing some subfolders
2. Run an Extended quick search with "Recursive" box checked for a phrase in 'whole message' or 'body part', e.g.

body_part matchcase "something"

EXPECTED:
Messages should be found

ACTUAL:
Waiting forever without finding any messages. Looking at network log (attached) shows errors. The only way to stop this is to kill claws-mail process.
Comment 1 George 2018-03-14 11:10:45 UTC
With a search like:

message matchcase "some@thing.com"

when the "some@thing.com" is part of some message's headers the problems seems not to appear.
Comment 2 Andrej Kacian 2018-03-14 20:19:18 UTC
I can confirm this, but only on Gmail, and only if the searched string contains non-ASCII characters.

Libetpan adds the "CHARSET UTF-8" parameter to the UID SEARCH command, which Gmail's IMAP implementation apparently does not support, and this error case apparently is not handled in Claws Mail, as it should error out instead of diving into an endless loop.

For now, you can get out of the loop by hitting Ctrl+W twice to toggle offline mode. That should make Claws snap out of it.
Comment 3 Andrej Kacian 2018-03-14 21:34:27 UTC
Created attachment 1857 [details]
Handle IMAP search failure instead of ignoring it

Attached patch makes Claws Mail error out on protocol error during search, disconnect the IMAP session, and display an error dialog about it.
Comment 4 George 2018-03-14 23:18:09 UTC
Thanks Andrej!
Comment 5 users 2018-03-15 20:35:05 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2018-03-15 20:35:05.470526677 +0100
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=9af9b6b567dc2b2e16fec0566807666724836b2a
Merge: 8f860bf 2d03eb9
Author: Colin Leroy <colin@colino.net>
Date:   Thu Mar 15 20:35:04 2018 +0100

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=2d03eb98268e11b12c698bb6f98c7fb2f3559e3b
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Wed Mar 14 21:35:05 2018 +0100

    Handle IMAP search failure instead of ignoring it.
    
    Error out on protocol error during search, disconnect
    the IMAP session, and display an error dialog about it.
    
    Closes bug 3986 - IMAP quick search using non-ASCII
    characters creates an infinite loop
Comment 6 Andrej Kacian 2018-03-15 22:18:18 UTC
Thanks for the report, the fix will be in next release.
Comment 7 simon.legner 2019-04-02 09:39:41 UTC
Could it be that those changed reintroduced bug 2744?