[akonadi] pull in some upstream fixes

Rex Dieter rdieter at fedoraproject.org
Tue Sep 16 02:23:49 UTC 2014


commit a87e2990ffc68380b208c07ab3ccda2c00f763c9
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Mon Sep 15 21:23:49 2014 -0500

    pull in some upstream fixes

 ...Use-CMAKE_FLAGS-the-right-way-in-try_comp.patch |   38 ++++
 ...r-the-test-directories-if-AKONADI_BUILD_T.patch |   82 ++++++++
 ...w-modifying-items-tags-via-Tag-RID-or-GID.patch |  201 ++++++++++++++++++++
 0004-Fix-typo-in-if-condition.patch                |   27 +++
 ...buffer-overflow-in-AKTEST_FAKESERVER_MAIN.patch |   25 +++
 akonadi.spec                                       |   12 +-
 6 files changed, 383 insertions(+), 2 deletions(-)
---
diff --git a/0001-FindSqlite-Use-CMAKE_FLAGS-the-right-way-in-try_comp.patch b/0001-FindSqlite-Use-CMAKE_FLAGS-the-right-way-in-try_comp.patch
new file mode 100644
index 0000000..0bad3aa
--- /dev/null
+++ b/0001-FindSqlite-Use-CMAKE_FLAGS-the-right-way-in-try_comp.patch
@@ -0,0 +1,38 @@
+From b60702e0b7041c56a3cb52c209204d28406f3ce5 Mon Sep 17 00:00:00 2001
+From: Raphael Kubo da Costa <rakuco at FreeBSD.org>
+Date: Wed, 13 Aug 2014 14:43:04 +0300
+Subject: [PATCH 1/5] FindSqlite: Use CMAKE_FLAGS the right way in
+ try_compile().
+
+This fixes f90774f1 ("Check whether Sqlite is compiled with
+SQLITE_ENABLE_UNLOCK_NOTIFY"), so that SQLITE_INCLUDE_DIR is really
+passed to the try_compile() call. So far, it was just a NOP and the
+compilation only worked if sqlite3.h was in a directory the compiler
+uses automatically.
+
+try_compile()'s syntax is a bit complicated, and CMAKE_FLAGS expects a
+series of arguments as if they had been passed to the command line, so
+instead of "CMAKE_FLAGS INCLUDE_DIRECTORIES /some/dir" one needs to use
+"CMAKE_FLAGS -DINCLUDE_DIRECTORIES:PATH=/some/dir".
+
+REVIEW: 119762
+---
+ cmake/modules/FindSqlite.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/modules/FindSqlite.cmake b/cmake/modules/FindSqlite.cmake
+index ad8cdb4..c43a7b5 100644
+--- a/cmake/modules/FindSqlite.cmake
++++ b/cmake/modules/FindSqlite.cmake
+@@ -94,7 +94,7 @@ if(EXISTS ${SQLITE_INCLUDE_DIR}/sqlite3.h)
+                 ${CMAKE_BINARY_DIR}/sqlite_check_unlock_notify
+                 ${CMAKE_BINARY_DIR}/sqlite_check_unlock_notify.cpp
+                 LINK_LIBRARIES ${SQLITE_LIBRARIES}
+-                CMAKE_FLAGS INCLUDE_DIRECTORIES ${SQLITE_INCLUDE_DIR})
++                CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${SQLITE_INCLUDE_DIR}")
+     if (NOT SQLITE_HAS_UNLOCK_NOTIFY)
+         message(STATUS "Sqlite ${SQLITE_VERSION} was found, but it is not compiled with -DSQLITE_ENABLE_UNLOCK_NOTIFY")
+     endif()
+-- 
+1.9.3
+
diff --git a/0002-Do-not-enter-the-test-directories-if-AKONADI_BUILD_T.patch b/0002-Do-not-enter-the-test-directories-if-AKONADI_BUILD_T.patch
new file mode 100644
index 0000000..8efd56e
--- /dev/null
+++ b/0002-Do-not-enter-the-test-directories-if-AKONADI_BUILD_T.patch
@@ -0,0 +1,82 @@
+From 2146519108ec66300328b7b3979477c7789795d3 Mon Sep 17 00:00:00 2001
+From: Raphael Kubo da Costa <rakuco at FreeBSD.org>
+Date: Wed, 13 Aug 2014 23:22:11 +0300
+Subject: [PATCH 2/5] Do not enter the test/ directories if AKONADI_BUILD_TESTS
+ is off.
+
+enable_testing() only determines whether a "test" target and the related
+CTest files will be created. And in Akonadi's case it is actually
+invoked regardless of the value of the AKONADI_BUILD_TESTS option
+because Akonadi includes the CTest module, which calls enable_testing()
+based on the value of another variable, BUILD_TESTING.
+
+In any case, whether the executables and libraries that compose
+Akonadi's unit tests will be built has nothing to do with
+enable_testing(). To make AKONADI_BUILD_TESTS really disable the build
+of the unit tests we now avoid entering the tests/ directories at all
+when it is off, so that neither tests nor targets they depend on get
+built.
+
+REVIEW: 119776
+---
+ CMakeLists.txt        | 6 +-----
+ libs/CMakeLists.txt   | 4 +++-
+ server/CMakeLists.txt | 5 ++++-
+ 3 files changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0c52009..e081d23 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,7 +14,7 @@ include(FeatureSummary)
+ 
+ ############### Build Options ###############
+ 
+-include(CTest)
++include(CTest)  # Calls enable_testing().
+ include(CTestConfig.cmake)
+ option(AKONADI_BUILD_TESTS "Build the Akonadi unit tests." TRUE)
+ option(AKONADI_BUILD_QSQLITE "Build the Sqlite backend." TRUE)
+@@ -27,10 +27,6 @@ if(NOT DEFINED DATABASE_BACKEND)
+   set(DATABASE_BACKEND "MYSQL" CACHE STRING "The default database backend to use for Akonadi. Can be either MYSQL, POSTGRES or SQLITE")
+ endif()
+ 
+-if(AKONADI_BUILD_TESTS)
+-  enable_testing()
+-endif()
+-
+ ############### CMake Macros ###############
+ 
+ include(InstallSettings)
+diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
+index de6ab0d..74de6b2 100644
+--- a/libs/CMakeLists.txt
++++ b/libs/CMakeLists.txt
+@@ -36,5 +36,7 @@ install(FILES
+   DESTINATION ${INCLUDE_INSTALL_DIR}/akonadi/private
+ )
+ 
+-add_subdirectory(tests)
++if(AKONADI_BUILD_TESTS)
++  add_subdirectory(tests)
++endif()
+ 
+diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
+index e4829f3..275938d 100644
+--- a/server/CMakeLists.txt
++++ b/server/CMakeLists.txt
+@@ -64,7 +64,10 @@ endmacro()
+ add_subdirectory(akonadictl)
+ add_subdirectory(control)
+ add_subdirectory(src)
+-add_subdirectory(tests)
++
++if(AKONADI_BUILD_TESTS)
++  add_subdirectory(tests)
++endif()
+ 
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_ENABLE_EXCEPTIONS}")
+ if(MYSQLD_EXECUTABLE)
+-- 
+1.9.3
+
diff --git a/0003-STORE-Allow-modifying-items-tags-via-Tag-RID-or-GID.patch b/0003-STORE-Allow-modifying-items-tags-via-Tag-RID-or-GID.patch
new file mode 100644
index 0000000..8538502
--- /dev/null
+++ b/0003-STORE-Allow-modifying-items-tags-via-Tag-RID-or-GID.patch
@@ -0,0 +1,201 @@
+From 9734074267bacd39aeb29c7a0d7df7cadb212d89 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Dan=20Vr=C3=A1til?= <dvratil at redhat.com>
+Date: Fri, 11 Jul 2014 18:33:39 +0200
+Subject: [PATCH 3/5] STORE: Allow modifying items tags via Tag RID or GID
+
+Tags RID is of course allowed only to resources
+
+(Cherry-picked from 1a619d4df010a4862621a03031176ad8759070d3)
+
+Conflicts:
+	CMakeLists.txt
+---
+ libs/protocol_p.h            |  2 ++
+ server/src/handler/store.cpp | 76 ++++++++++++++++++++++++++++++--------------
+ server/src/handler/store.h   |  8 +++--
+ server/src/handlerhelper.cpp |  4 +--
+ 4 files changed, 62 insertions(+), 28 deletions(-)
+
+diff --git a/libs/protocol_p.h b/libs/protocol_p.h
+index 002abe4..2ec2a2e 100644
+--- a/libs/protocol_p.h
++++ b/libs/protocol_p.h
+@@ -110,6 +110,7 @@
+ #define AKONADI_PARAM_TAGS                         "TAGS"
+ #define AKONADI_PARAM_FULLPAYLOAD                  "FULLPAYLOAD"
+ #define AKONADI_PARAM_GID                          "GID"
++#define AKONADI_PARAM_GTAGS                        "GTAGS"
+ #define AKONADI_PARAM_IGNOREERRORS                 "IGNOREERRORS"
+ #define AKONADI_PARAM_INDEX                        "INDEX"
+ #define AKONADI_PARAM_INHERIT                      "INHERIT"
+@@ -137,6 +138,7 @@
+ #define AKONADI_PARAM_REMOTEREVISION               "REMOTEREVISION"
+ #define AKONADI_PARAM_RESOURCE                     "RESOURCE"
+ #define AKONADI_PARAM_REVISION                     "REV"
++#define AKONADI_PARAM_RTAGS                        "RTAGS"
+ #define AKONADI_PARAM_SILENT                       "SILENT"
+ #define AKONADI_PARAM_DOT_SILENT                   ".SILENT"
+ #define AKONADI_PARAM_CAPABILITY_SERVERSEARCH      "SERVERSEARCH"
+diff --git a/server/src/handler/store.cpp b/server/src/handler/store.cpp
+index 6664a09..4a503a2 100644
+--- a/server/src/handler/store.cpp
++++ b/server/src/handler/store.cpp
+@@ -115,35 +115,56 @@ bool Store::deleteFlags( const PimItem::List &items, const QVector<QByteArray> &
+   return true;
+ }
+ 
+-bool Store::replaceTags( const PimItem::List &item, const ImapSet &tags )
++bool Store::replaceTags( const PimItem::List &item, const Tag::List &tags )
+ {
+-  const Tag::List tagList = HandlerHelper::resolveTags( tags );
+-  if ( !connection()->storageBackend()->setItemsTags( item, tagList ) ) {
++  if ( !connection()->storageBackend()->setItemsTags( item, tags ) ) {
+     throw HandlerException( "Store::replaceTags: Unable to set new item tags" );
+   }
+   return true;
+ }
+ 
+-bool Store::addTags( const PimItem::List &items, const ImapSet &tags, bool &tagsChanged )
++bool Store::addTags( const PimItem::List &items, const Tag::List &tags, bool &tagsChanged )
+ {
+-  const Tag::List tagList = HandlerHelper::resolveTags( tags );
+-  if ( !connection()->storageBackend()->appendItemsTags( items, tagList, &tagsChanged ) ) {
++  if ( !connection()->storageBackend()->appendItemsTags( items, tags, &tagsChanged ) ) {
+     akDebug() << "Store::addTags: Unable to add new item tags";
+     return false;
+   }
+   return true;
+ }
+ 
+-bool Store::deleteTags( const PimItem::List &items, const ImapSet &tags )
++bool Store::deleteTags( const PimItem::List &items, const Tag::List &tags )
+ {
+-  const Tag::List tagList = HandlerHelper::resolveTags( tags );
+-  if ( !connection()->storageBackend()->removeItemsTags( items, tagList ) ) {
++  if ( !connection()->storageBackend()->removeItemsTags( items, tags ) ) {
+     akDebug() << "Store::deleteTags: Unable to remove item tags";
+     return false;
+   }
+   return true;
+ }
+ 
++bool Store::processTagsChange( Store::Operation op, const PimItem::List &items,
++                               const Tag::List &tags, QSet<QByteArray> &changes )
++{
++  bool tagsChanged = true;
++  if ( op == Replace ) {
++    tagsChanged = replaceTags( items, tags );
++  } else if ( op == Add ) {
++    if ( !addTags( items, tags, tagsChanged ) ) {
++      return failureResponse( "Unable to add item tags." );
++    }
++  } else if ( op == Delete ) {
++    if ( !( tagsChanged = deleteTags( items, tags ) ) ) {
++      return failureResponse( "Unable to remove item tags." );
++    }
++  }
++
++  if ( tagsChanged && !changes.contains( AKONADI_PARAM_TAGS ) ) {
++    changes << AKONADI_PARAM_TAGS;
++  }
++
++  return true;
++}
++
++
+ bool Store::parseStream()
+ {
+   parseCommand();
+@@ -234,22 +255,31 @@ bool Store::parseStream()
+     }
+ 
+     if ( command == AKONADI_PARAM_TAGS ) {
+-      bool tagsChanged = true;
+-      const ImapSet tags = m_streamParser->readSequenceSet();
+-      if ( op == Replace ) {
+-        tagsChanged = replaceTags( pimItems, tags );
+-      } else if ( op == Add ) {
+-        if ( !addTags( pimItems, tags, tagsChanged ) ) {
+-          return failureResponse( "Unable to add item tags." );
+-        }
+-      } else if ( op == Delete ) {
+-        if ( !( tagsChanged = deleteTags( pimItems, tags ) ) ) {
+-          return failureResponse( "Unable to remove item tags." );
+-        }
++      const ImapSet tagsIds = m_streamParser->readSequenceSet();
++      const Tag::List tags = HandlerHelper::resolveTags( tagsIds );
++      if (!processTagsChange( op, pimItems, tags, changes )) {
++        return false;
+       }
++      continue;
++    }
++
++    if ( command == AKONADI_PARAM_RTAGS ) {
++      if (!connection()->context()->resource().isValid()) {
++        throw HandlerException( "Only resources can use RTAGS" );
++      }
++      const QVector<QByteArray> tagsIds = m_streamParser->readParenthesizedList().toVector();
++      const Tag::List tags = HandlerHelper::resolveTagsByRID( tagsIds, connection()->context() );
++      if (!processTagsChange( op, pimItems, tags, changes )) {
++        return false;
++      }
++      continue;
++    }
+ 
+-      if ( tagsChanged && !changes.contains( AKONADI_PARAM_TAGS ) ) {
+-        changes << AKONADI_PARAM_TAGS;
++    if ( command == AKONADI_PARAM_GTAGS ) {
++      const QVector<QByteArray> tagsIds = m_streamParser->readParenthesizedList().toVector();
++      const Tag::List tags = HandlerHelper::resolveTagsByGID( tagsIds );
++      if (!processTagsChange( op, pimItems, tags, changes )) {
++        return false;
+       }
+       continue;
+     }
+diff --git a/server/src/handler/store.h b/server/src/handler/store.h
+index ad3a5a0..c618a53 100644
+--- a/server/src/handler/store.h
++++ b/server/src/handler/store.h
+@@ -115,12 +115,14 @@ class Store : public Handler
+     bool replaceFlags( const PimItem::List &items, const QVector<QByteArray> &flags );
+     bool addFlags( const PimItem::List &items, const QVector<QByteArray> &flags, bool &flagsChanged );
+     bool deleteFlags( const PimItem::List &items, const QVector<QByteArray> &flags );
+-    bool replaceTags( const PimItem::List &items, const ImapSet &tags );
+-    bool addTags( const PimItem::List &items, const ImapSet &tags, bool &tagsChanged );
+-    bool deleteTags( const PimItem::List &items, const ImapSet &tags );
++    bool replaceTags( const PimItem::List &items, const Tag::List &tags );
++    bool addTags( const PimItem::List &items, const Tag::List &tags, bool &tagsChanged );
++    bool deleteTags( const PimItem::List &items, const Tag::List &tags );
+     bool setGid( const PimItem &item, const QString &gid );
+     void sendPimItemResponse( const PimItem &pimItem );
+ 
++    bool processTagsChange(Store::Operation operation, const PimItem::List &items, const Tag::List &tags, QSet<QByteArray> &changes);
++
+   private:
+     Scope mScope;
+     int mPos;
+diff --git a/server/src/handlerhelper.cpp b/server/src/handlerhelper.cpp
+index 763ea30..634a26c 100644
+--- a/server/src/handlerhelper.cpp
++++ b/server/src/handlerhelper.cpp
+@@ -366,7 +366,7 @@ Tag::List HandlerHelper::resolveTagsByGID(const QVector<QByteArray> &tagsGIDs)
+     }
+ 
+     Q_FOREACH (const QByteArray &tagGID, tagsGIDs) {
+-        Tag::List tags = Tag::retrieveFiltered(Tag::gidColumn(), tagGID);
++        Tag::List tags = Tag::retrieveFiltered(Tag::gidColumn(), QString::fromLatin1(tagGID));
+         Tag tag;
+         if (tags.isEmpty()) {
+             tag.setGid(QString::fromUtf8(tagGID));
+@@ -413,7 +413,7 @@ Tag::List HandlerHelper::resolveTagsByRID(const QVector< QByteArray >& tagsRIDs,
+         cond.addColumnCondition(Tag::idFullColumnName(), Query::Equals, TagRemoteIdResourceRelation::tagIdFullColumnName());
+         cond.addValueCondition(TagRemoteIdResourceRelation::resourceIdFullColumnName(), Query::Equals, context->resource().id());
+         qb.addJoin(QueryBuilder::LeftJoin, TagRemoteIdResourceRelation::tableName(), cond);
+-        qb.addValueCondition(TagRemoteIdResourceRelation::remoteIdFullColumnName(), Query::Equals, tagRID);
++        qb.addValueCondition(TagRemoteIdResourceRelation::remoteIdFullColumnName(), Query::Equals, QString::fromLatin1(tagRID));
+         if (!qb.exec()) {
+             throw HandlerException("Unable to resolve tags");
+         }
+-- 
+1.9.3
+
diff --git a/0004-Fix-typo-in-if-condition.patch b/0004-Fix-typo-in-if-condition.patch
new file mode 100644
index 0000000..b3febdc
--- /dev/null
+++ b/0004-Fix-typo-in-if-condition.patch
@@ -0,0 +1,27 @@
+From e52f9be20e566e507e77421f1243f51aa2fe8e55 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Dan=20Vr=C3=A1til?= <dvratil at redhat.com>
+Date: Mon, 25 Aug 2014 14:35:14 +0200
+Subject: [PATCH 4/5] Fix typo in if condition
+
+BUG: 338483
+FIXED-IN: 1.13.1
+---
+ server/src/handler/akappend.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/server/src/handler/akappend.cpp b/server/src/handler/akappend.cpp
+index 43f03ba..ad3682f 100644
+--- a/server/src/handler/akappend.cpp
++++ b/server/src/handler/akappend.cpp
+@@ -380,7 +380,7 @@ bool AkAppend::parseStream()
+   if ( itemFlags.incremental ) {
+     throw HandlerException( "Incremental flags changes are not allowed in AK-APPEND" );
+   }
+-  if ( itemTagsRID.incremental || itemTagsRID.incremental ) {
++  if ( itemTagsRID.incremental || itemTagsGID.incremental ) {
+     throw HandlerException( "Incremental tags changes are not allowed in AK-APPEND" );
+   }
+ 
+-- 
+1.9.3
+
diff --git a/0005-Fix-buffer-overflow-in-AKTEST_FAKESERVER_MAIN.patch b/0005-Fix-buffer-overflow-in-AKTEST_FAKESERVER_MAIN.patch
new file mode 100644
index 0000000..8cfaaae
--- /dev/null
+++ b/0005-Fix-buffer-overflow-in-AKTEST_FAKESERVER_MAIN.patch
@@ -0,0 +1,25 @@
+From 01c86229f9e26d9e036f6f2ab405659ed836b5c0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Dan=20Vr=C3=A1til?= <dvratil at redhat.com>
+Date: Mon, 8 Sep 2014 15:36:18 +0200
+Subject: [PATCH 5/5] Fix buffer overflow in AKTEST_FAKESERVER_MAIN()
+
+---
+ shared/aktest.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/shared/aktest.h b/shared/aktest.h
+index b1b9caa..3026304 100644
+--- a/shared/aktest.h
++++ b/shared/aktest.h
+@@ -57,7 +57,7 @@ int main(int argc, char **argv) \
+       } \
+   } \
+   TestObject tc; \
+-  char **fakeArgv = (char **) malloc(options.count()); \
++  char **fakeArgv = (char **) malloc(options.count() * sizeof(char**)); \
+   for (int i = 0; i < options.count(); ++i) { \
+       fakeArgv[i] = options[i]; \
+   } \
+-- 
+1.9.3
+
diff --git a/akonadi.spec b/akonadi.spec
index bc8d3ff..f3dc531 100644
--- a/akonadi.spec
+++ b/akonadi.spec
@@ -19,7 +19,7 @@
 Summary: PIM Storage Service
 Name:    akonadi
 Version: 1.13.0
-Release: 2%{?dist}
+Release: 3%{?dist}
 
 License: LGPLv2+
 URL:     http://community.kde.org/KDE_PIM/Akonadi 
@@ -38,6 +38,11 @@ Source10: akonadiserverrc.mysql
 ## upstreamable patches
 
 ## upstream patches
+Patch1: 0001-FindSqlite-Use-CMAKE_FLAGS-the-right-way-in-try_comp.patch
+Patch2: 0002-Do-not-enter-the-test-directories-if-AKONADI_BUILD_T.patch
+Patch3: 0003-STORE-Allow-modifying-items-tags-via-Tag-RID-or-GID.patch
+Patch4: 0004-Fix-typo-in-if-condition.patch
+Patch5: 0005-Fix-buffer-overflow-in-AKTEST_FAKESERVER_MAIN.patch
 
 %define mysql_conf_timestamp 20140709
 
@@ -92,7 +97,7 @@ See also: %{_sysconfdir}/akonadi/mysql-global.conf
 
 
 %prep
-%setup -q -n akonadi-%{version}
+%autosetup -p1 -n akonadi-%{version}
 
 
 %build
@@ -201,6 +206,9 @@ fi
 
 
 %changelog
+* Mon Sep 15 2014 Rex Dieter <rdieter at fedoraproject.org> 1.13.0-3
+- pull in some upstream fixes
+
 * Fri Aug 15 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.13.0-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list