diff options
author | markd <markd> | 2016-01-10 19:40:30 +0000 |
---|---|---|
committer | markd <markd> | 2016-01-10 19:40:30 +0000 |
commit | 4b8b5938a0a1eda7f48cc291dd823b180e12f0b4 (patch) | |
tree | 14c11370f22022e01b28ea7e1945cbdde4237ede /mail | |
parent | dac9d4d84ad70f3ea8e75d1c2958e9f2a7ff35be (diff) | |
download | pkgsrc-4b8b5938a0a1eda7f48cc291dd823b180e12f0b4.tar.gz |
Don't leak old external payload files. Bump PKGREVISION.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/akonadi/Makefile | 4 | ||||
-rw-r--r-- | mail/akonadi/distinfo | 4 | ||||
-rw-r--r-- | mail/akonadi/patches/patch-server_src_storage_partstreamer.cpp | 53 | ||||
-rw-r--r-- | mail/akonadi/patches/patch-server_tests_unittest_partstreamertest.cpp | 100 |
4 files changed, 158 insertions, 3 deletions
diff --git a/mail/akonadi/Makefile b/mail/akonadi/Makefile index bb8397ced9d..89941f0c136 100644 --- a/mail/akonadi/Makefile +++ b/mail/akonadi/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.70 2015/10/10 01:58:11 ryoon Exp $ +# $NetBSD: Makefile,v 1.71 2016/01/10 19:40:30 markd Exp $ DISTNAME= akonadi-1.13.0 -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= mail MASTER_SITES= ftp://kde.mirror.anlx.net/stable/akonadi/src/ EXTRACT_SUFX= .tar.bz2 diff --git a/mail/akonadi/distinfo b/mail/akonadi/distinfo index 5caba1a6bcf..1cfd8a90574 100644 --- a/mail/akonadi/distinfo +++ b/mail/akonadi/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.22 2015/11/03 23:27:01 agc Exp $ +$NetBSD: distinfo,v 1.23 2016/01/10 19:40:30 markd Exp $ SHA1 (akonadi-1.13.0.tar.bz2) = 9d594b5840e2e5d90057a7e5d8545004a3476bc0 RMD160 (akonadi-1.13.0.tar.bz2) = 411e4e3b203cd9681b10d21af75806f723a687ec @@ -8,3 +8,5 @@ SHA1 (patch-agentserver_CMakeLists.txt) = 01249fd521e23a8cb8c7119ad9c8cd9877338c SHA1 (patch-cmake_modules_FindSqlite.cmake) = 3deefae90ec3485affeda4de283d4166d85c41fc SHA1 (patch-git_21465191) = 735e05bfa08c113ec196049dcea035f889cd7b6d SHA1 (patch-libs_xdgbasedirs.cpp) = eccf2de9445ea63eb09529e077d36f43303bd0ee +SHA1 (patch-server_src_storage_partstreamer.cpp) = c8de60299129673d5cfb699c8c73a9275088fd61 +SHA1 (patch-server_tests_unittest_partstreamertest.cpp) = 1068831b3abeb855f759941d5e38bd86ef89cf0a diff --git a/mail/akonadi/patches/patch-server_src_storage_partstreamer.cpp b/mail/akonadi/patches/patch-server_src_storage_partstreamer.cpp new file mode 100644 index 00000000000..c79b86261d4 --- /dev/null +++ b/mail/akonadi/patches/patch-server_src_storage_partstreamer.cpp @@ -0,0 +1,53 @@ +$NetBSD: patch-server_src_storage_partstreamer.cpp,v 1.1 2016/01/10 19:40:30 markd Exp $ + +From: Dan Vrátil <dvratil@redhat.com> +Date: Mon, 29 Jun 2015 20:45:11 +0000 +Subject: Don't leak old external payload files +X-Git-Url: http://quickgit.kde.org/?p=akonadi.git&a=commitdiff&h=9c0dc6b3f0826d32eac310b2e7ecd858ca3df681 +--- +Don't leak old external payload files + +Actually delete old payload files after we increase the payload revision or +switch from external to internal payload. This caused ~/.local/share/akonadi/file_db_data +to grow insanely for all users, leaving them with many duplicated files (just with +different revisions). + +It is recommended that users run akonadictl fsck to clean up the leaked payload +files. + +Note that there won't be any more releases of Akonadi 1.13 (and this has been +fixed in master already), so I strongly recommend distributions to pick this +patch into their packaging. + +BUG: 341884 +CCBUG: 338402 +--- server/src/storage/partstreamer.cpp.orig 2014-08-10 10:38:58.000000000 +0000 ++++ server/src/storage/partstreamer.cpp +@@ -290,6 +290,12 @@ bool PartStreamer::stream(const QByteArr + mDataChanged = true; + } + ++ // If the part is external, remember it's current file name ++ QString originalFile; ++ if (part.isValid() && part.external()) { ++ originalFile = PartHelper::resolveAbsolutePath(part.data()); ++ } ++ + part.setPartType(partType); + part.setVersion(partVersion); + part.setPimItemId(mItem.id()); +@@ -306,6 +312,14 @@ bool PartStreamer::stream(const QByteArr + *changed = mDataChanged; + } + ++ if (!originalFile.isEmpty()) { ++ // If the part was external but is not anymore, or if it's still external ++ // but the filename has changed (revision update), remove the original file ++ if (!part.external() || (part.external() && originalFile != PartHelper::resolveAbsolutePath(part.data()))) { ++ PartHelper::removeFile(originalFile); ++ } ++ } ++ + return ok; + } + diff --git a/mail/akonadi/patches/patch-server_tests_unittest_partstreamertest.cpp b/mail/akonadi/patches/patch-server_tests_unittest_partstreamertest.cpp new file mode 100644 index 00000000000..c297021f5b1 --- /dev/null +++ b/mail/akonadi/patches/patch-server_tests_unittest_partstreamertest.cpp @@ -0,0 +1,100 @@ +$NetBSD: patch-server_tests_unittest_partstreamertest.cpp,v 1.1 2016/01/10 19:40:30 markd Exp $ + +From: Dan Vrátil <dvratil@redhat.com> +Date: Mon, 29 Jun 2015 20:45:11 +0000 +Subject: Don't leak old external payload files +X-Git-Url: http://quickgit.kde.org/?p=akonadi.git&a=commitdiff&h=9c0dc6b3f0826d32eac310b2e7ecd858ca3df681 +--- +Don't leak old external payload files + +Actually delete old payload files after we increase the payload revision or +switch from external to internal payload. This caused ~/.local/share/akonadi/file_db_data +to grow insanely for all users, leaving them with many duplicated files (just with +different revisions). + +It is recommended that users run akonadictl fsck to clean up the leaked payload +files. + +Note that there won't be any more releases of Akonadi 1.13 (and this has been +fixed in master already), so I strongly recommend distributions to pick this +patch into their packaging. + +BUG: 341884 +CCBUG: 338402 +--- server/tests/unittest/partstreamertest.cpp.orig 2014-08-10 10:38:58.000000000 +0000 ++++ server/tests/unittest/partstreamertest.cpp +@@ -91,6 +91,7 @@ private Q_SLOTS: + QTest::addColumn<qint64>("expectedPartSize"); + QTest::addColumn<bool>("expectedChanged"); + QTest::addColumn<bool>("isExternal"); ++ QTest::addColumn<int>("version"); + QTest::addColumn<PimItem>("pimItem"); + + PimItem item; +@@ -101,13 +102,12 @@ private Q_SLOTS: + QVERIFY(item.insert()); + + // Order of these tests matters! +- QTest::newRow("item 1, internal") << QByteArray("PLD:DATA") << QByteArray("123") << 3ll << true << false << item; +- QTest::newRow("item 1, change to external") << QByteArray("PLD:DATA") << QByteArray("123456789") << 9ll << true << true << item; +- QTest::newRow("item 1, update external") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << true << true << item; +- QTest::newRow("item 1, external, no change") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << false << true << item; +- QTest::newRow("item 1, change to internal") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << true << false << item; +- QTest::newRow("item 1, internal, no change") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << false << false << item; +- } ++ QTest::newRow("item 1, internal") << QByteArray("PLD:DATA") << QByteArray("123") << 3ll << true << false << -1 << item; ++ QTest::newRow("item 1, change to external") << QByteArray("PLD:DATA") << QByteArray("123456789") << 9ll << true << true << 0 << item; ++ QTest::newRow("item 1, update external") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << true << true << 1 << item; ++ QTest::newRow("item 1, external, no change") << QByteArray("PLD:DATA") << QByteArray("987654321") << 9ll << false << true << 2 << item; ++ QTest::newRow("item 1, change to internal") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << true << false << 2 << item; ++ QTest::newRow("item 1, internal, no change") << QByteArray("PLD:DATA") << QByteArray("1234") << 4ll << false << false << 2 << item; } + + void testStreamer() + { +@@ -117,6 +117,7 @@ private Q_SLOTS: + QFETCH(qint64, expectedPartSize); + QFETCH(bool, expectedChanged); + QFETCH(bool, isExternal); ++ QFETCH(int, version); + QFETCH(PimItem, pimItem); + + FakeConnection connection; +@@ -160,17 +161,18 @@ private Q_SLOTS: + + PimItem item = PimItem::retrieveById(pimItem.id()); + const QVector<Part> parts = item.parts(); +- QVERIFY(parts.count() == 1); ++ QCOMPARE(parts.count(), 1); + const Part part = parts[0]; + QCOMPARE(part.datasize(), expectedPartSize); + QCOMPARE(part.external(), isExternal); ++ qDebug() << part.version() << part.data(); + const QByteArray data = part.data(); + if (isExternal) { + QVERIFY(streamerSpy.count() == 1); + QVERIFY(streamerSpy.first().count() == 1); + const Response response = streamerSpy.first().first().value<Akonadi::Server::Response>(); + const QByteArray str = response.asString(); +- const QByteArray expectedResponse = "+ STREAM [FILE " + QByteArray::number(part.id()) + "_r" + QByteArray::number(part.version()) + "]"; ++ const QByteArray expectedResponse = "+ STREAM [FILE " + QByteArray::number(part.id()) + "_r" + QByteArray::number(version) + "]"; + QCOMPARE(QString::fromUtf8(str), QString::fromUtf8(expectedResponse)); + + QFile file(PartHelper::resolveAbsolutePath(data)); +@@ -182,7 +184,7 @@ private Q_SLOTS: + QCOMPARE(fileData, expectedData); + + // Make sure no previous versions are left behind in file_db_data +- for (int i = 0; i < part.version(); ++i) { ++ for (int i = 0; i < version; ++i) { + const QByteArray fileName = QByteArray::number(part.id()) + "_r" + QByteArray::number(part.version()); + const QString filePath = PartHelper::resolveAbsolutePath(fileName); + QVERIFY(!QFile::exists(filePath)); +@@ -194,7 +196,7 @@ private Q_SLOTS: + QCOMPARE(data, expectedData); + + // Make sure nothing is left behind in file_db_data +- for (int i = 0; i <= part.version(); ++i) { ++ for (int i = 0; i <= version; ++i) { + const QByteArray fileName = QByteArray::number(part.id()) + "_r" + QByteArray::number(part.version()); + const QString filePath = PartHelper::resolveAbsolutePath(fileName); + QVERIFY(!QFile::exists(filePath)); |