When I open a folder and press "search", then enter any searchword that starts with a hyphen ("-anything" for example) the app crashes immediately after pressing enter.
Give me a list of messages containing the given phrase.
App crashes
K-9 Mail version: 5.600
Android version: 8.0.0 / 7.1.1
Account type (IMAP, POP3, WebDAV/Exchange): IMAP
Hi. I want to conrtibute. Is this issue assigned to someone?
@foxtrot95 not that I know of but if you try the master branch you may run into #3716...
Found this in logs from my previous tests:
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: android.database.sqlite.SQLiteException: malformed MATCH expression: [-sddd] (code 1)
#################################################################
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(malformed MATCH expression: [-sddd] (code 1))
#################################################################
at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)
at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:1017)
at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:152)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:141)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:219)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:268)
at android.database.CursorWrapper.moveToNext(CursorWrapper.java:202)
at android.database.CursorWrapper.moveToNext(CursorWrapper.java:202)
at com.fsck.k9.cache.EmailProviderCacheCursor.<init>(EmailProviderCacheCursor.java:46)
at com.fsck.k9.provider.EmailProvider.query(EmailProvider.java:253)
at android.content.ContentProvider.query(ContentProvider.java:1063)
at android.content.ContentProvider.query(ContentProvider.java:1155)
at android.content.ContentProvider$Transport.query(ContentProvider.java:244)
at android.content.ContentResolver.query(ContentResolver.java:760)
at android.content.ContentResolver.query(ContentResolver.java:710)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:64)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:54)
at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:315)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:69)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:64)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more
I assume this is because the search term is passed to SQLite as a full-text-search query and - means "NOT". See section 3.2 of https://sqlite.org/fts3.html :
An FTS query may not consist entirely of terms or term-prefix queries with unary "-" operators attached to them.
You can search for -foo using double-quotes, i.e.
"-foo"
Perhaps we can fix this by catching certain SQLiteExceptions and showing a popup with the relevant syntax including the requirement to quote hyphens?
if you surround the - with [ ] then it should work