GNOME Bugzilla – Bug 564954
"Match All" search folder shows no messages
Last modified: 2009-01-12 05:13:59 UTC
Please describe the problem: A search folder with the single criterion "Match All" and "Include threads" set to "None" shows no messages. It should show all messages from its source folders. I'm using the latest code from the 2.24 branch. Steps to reproduce: 1. Run Evolution in a new user account and complete the email setup wizard. 2. Create a search folder with source "All local folders", single criterion "Match All", and "Include threads" set to "None". 3. Restart Evolution so the search folder appears (bug 564953). 4. If the Inbox does not already contain the "Welcome to Evolution" message, add a message to it via "Message" -> "Post New Message to Folder". 5. Open the search folder. Actual results: No messages appear in the search folder. Expected results: All local messages appear in the search folder. Does this happen every time? Yes. Other information: Setting CAMEL_DEBUG=search reveals that Evolution is converting the search folder expression to a corrupt SQL query: sexp is : [ (and (match-all #t) ) ] Equivalent sql SELECT uid FROM 'Templates' WHERE I imagine this causes an exception, but Evolution ignores the exception and just shows an empty folder (those "FIXME[disk-summary]"s bite!). A workaround is to set "Include threads" to "All related". This doesn't change the set of matching messages, but the use of match-threads forces Evolution to do the search in memory instead of using the broken DB query.
Created attachment 124909 [details] [review] Fix SQL-ization of booleans and immediate-function confusion For a reason beyond me, the code in match_all in camel-search-sql-sexp.c converted a boolean literal to the empty string. I changed it to generate "1" or "0" as appropriate. I also noticed that match_all and match_threads had the signature of an immediate function but were added to the sexp evaluator as normal functions. That means the evaluator was passing them _ESExpResults, which they treated as _ESExpTerms. I guess the two structures happen to be similar enough that this totally bogus interfacing did not cause crashes, though it did require the weird-looking use of ESEXP_TERM_TIME (which has the same value as ESEXP_RES_BOOL) in match_all to test whether the result was a boolean. My patch straightens this out by adding match_all and match_threads as immediate functions, as their bodies expect.
see bug 565483 also
Looks good to commit to stable/trunk
Patch committed stable (gnome-2-24) branch as r9914 http://svn.gnome.org/viewvc/evolution-data-server?view=revision&revision=9914 Patch committed to SVN trunk as r9915 http://svn.gnome.org/viewvc/evolution-data-server?view=revision&revision=9915
It works, thanks!