Hello community, here is the log from the commit of package kmime for openSUSE:Factory checked in at 2020-06-14 18:21:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kmime (Old) and /work/SRC/openSUSE:Factory/.kmime.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kmime" Sun Jun 14 18:21:30 2020 rev:59 rq:813683 version:20.04.2 Changes: -------- --- /work/SRC/openSUSE:Factory/kmime/kmime.changes 2020-05-20 18:41:40.212771189 +0200 +++ /work/SRC/openSUSE:Factory/.kmime.new.3606/kmime.changes 2020-06-14 18:21:39.955906872 +0200 @@ -1,0 +2,12 @@ +Tue Jun 9 12:15:18 UTC 2020 - Christophe Giboudeaux <[email protected]> + +- Update to 20.04.2 + * New bugfix release + * For more details please see: + * https://kde.org/announcements/releases/2020-06-apps-update +- Changes since 20.04.1: + * Add CRtoLF method + * Add autotest for bug 392239 + * Fix parsing headers with a name that is a prefix of a well-known header + +------------------------------------------------------------------- Old: ---- kmime-20.04.1.tar.xz kmime-20.04.1.tar.xz.sig New: ---- kmime-20.04.2.tar.xz kmime-20.04.2.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kmime.spec ++++++ --- /var/tmp/diff_new_pack.jieukc/_old 2020-06-14 18:21:40.603908963 +0200 +++ /var/tmp/diff_new_pack.jieukc/_new 2020-06-14 18:21:40.603908963 +0200 @@ -21,7 +21,7 @@ %{!?_kapp_version: %define _kapp_version %(echo %{version}| awk -F. '{print $1"."$2}')} %bcond_without lang Name: kmime -Version: 20.04.1 +Version: 20.04.2 Release: 0 Summary: KDE PIM libraries MIME support License: LGPL-2.1-or-later ++++++ kmime-20.04.1.tar.xz -> kmime-20.04.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/CMakeLists.txt new/kmime-20.04.2/CMakeLists.txt --- old/kmime-20.04.1/CMakeLists.txt 2020-05-12 03:24:45.000000000 +0200 +++ new/kmime-20.04.2/CMakeLists.txt 2020-06-09 02:44:22.000000000 +0200 @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -set(PIM_VERSION "5.14.1") +set(PIM_VERSION "5.14.2") project(KMime VERSION ${PIM_VERSION}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/autotests/data/mails/bug392239.mbox new/kmime-20.04.2/autotests/data/mails/bug392239.mbox --- old/kmime-20.04.1/autotests/data/mails/bug392239.mbox 1970-01-01 01:00:00.000000000 +0100 +++ new/kmime-20.04.2/autotests/data/mails/bug392239.mbox 2020-05-25 08:05:16.000000000 +0200 @@ -0,0 +1,19 @@ +Mime-Version: 1.0 +Content-Type: multipart/mixed;boundary="4D_=================1016175744==" +Date: Thu, 21 May 2020 00:00:00 +0000 +To: [email protected] +From: [email protected] +Subject: + +--4D_=================1016175744== +Content-Type: text/plain;charset="utf-8" +Content-Transfer-Encoding: base64 + +Rm9sbG93aW5nIHRoaXMgcGFyYWdyYXBoIHRoZXJlIGlzIGEgZG91YmxlIGxpbmUgYnJlYWsgd2hp +Y2ggc2hvdWxkIHJlc3VsdCBpbiB2ZXJ0aWNhbCBzcGFjaW5nLg0NUHJlY2VkaW5nIHRoaXMgcGFy +YWdyYXBoIHRoZXJlIGlzIGEgZG91YmxlIGxpbmUgYnJlYWsgd2hpY2ggc2hvdWxkIHJlc3VsdCBp +biB2ZXJ0aWNhbCBzcGFjaW5nLg0= + +--4D_=================1016175744==-- + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/autotests/data/mails/reply-header.mbox new/kmime-20.04.2/autotests/data/mails/reply-header.mbox --- old/kmime-20.04.1/autotests/data/mails/reply-header.mbox 1970-01-01 01:00:00.000000000 +0100 +++ new/kmime-20.04.2/autotests/data/mails/reply-header.mbox 2020-05-25 08:05:16.000000000 +0200 @@ -0,0 +1,6 @@ +From [email protected] Fri May 08 12:59:02 2020 +Reply: Weird Receiver <[email protected]> +To: Volker Krause <[email protected]> +From: Null <[email protected]> + +Hi Volker, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/autotests/messagetest.cpp new/kmime-20.04.2/autotests/messagetest.cpp --- old/kmime-20.04.1/autotests/messagetest.cpp 2020-05-10 14:23:01.000000000 +0200 +++ new/kmime-20.04.2/autotests/messagetest.cpp 2020-05-25 08:05:16.000000000 +0200 @@ -630,6 +630,16 @@ QVERIFY(msg->subject()->asUnicodeString().isEmpty()); } +void MessageTest::testReplyHeader() +{ + auto msg = readAndParseMail(QStringLiteral("reply-header.mbox")); + QVERIFY(msg); + QVERIFY(!msg->replyTo(false)); + QCOMPARE(msg->hasHeader("Reply-To"), false); + QCOMPARE(msg->hasHeader("Reply"), true); + QVERIFY(msg->headerByType("Reply")); +} + KMime::Message::Ptr MessageTest::readAndParseMail(const QString &mailFile) const { QFile file(QLatin1String(TEST_DATA_DIR) + QLatin1String("/mails/") + mailFile); @@ -646,3 +656,24 @@ return msg; } +void MessageTest::testBug392239() +{ + auto msg = readAndParseMail(QStringLiteral("bug392239.mbox")); + + QCOMPARE(msg->subject()->as7BitString().data(), "Subject: "); + QCOMPARE(msg->contents().size(), 0); + QCOMPARE(msg->contentTransferEncoding()->encoding(), KMime::Headers::CEbase64); + QCOMPARE(msg->decodedText().toUtf8().data(), "Following this paragraph there is a double line break which should result in vertical spacing.\r\rPreceding this paragraph there is a double line break which should result in vertical spacing.\r"); + const QByteArray data = KMime::CRtoLF(msg->decodedText().toUtf8()); + QCOMPARE(data, "Following this paragraph there is a double line break which should result in vertical spacing.\n\nPreceding this paragraph there is a double line break which should result in vertical spacing.\n"); +} + +void MessageTest::testCRtoLF() +{ + QByteArray data = "Subject: Test\n"; + QCOMPARE(CRtoLF(data), "Subject: Test\n"); + data = "Subject: Test\r"; + QCOMPARE(CRtoLF(data), "Subject: Test\n"); + data = "Subject: Test\r\n"; + QCOMPARE(CRtoLF(data), "Subject: Test\r\n"); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/autotests/messagetest.h new/kmime-20.04.2/autotests/messagetest.h --- old/kmime-20.04.1/autotests/messagetest.h 2020-05-10 14:23:01.000000000 +0200 +++ new/kmime-20.04.2/autotests/messagetest.h 2020-05-25 08:05:16.000000000 +0200 @@ -47,7 +47,10 @@ void testEncryptedMails(); void testReturnSameMail(); void testEmptySubject(); + void testReplyHeader(); + void testBug392239(); + void testCRtoLF(); private: KMime::Message::Ptr readAndParseMail(const QString &mailFile) const; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/src/kmime_headerfactory.cpp new/kmime-20.04.2/src/kmime_headerfactory.cpp --- old/kmime-20.04.1/src/kmime_headerfactory.cpp 2020-05-10 14:23:01.000000000 +0200 +++ new/kmime-20.04.2/src/kmime_headerfactory.cpp 2020-05-25 08:05:16.000000000 +0200 @@ -38,8 +38,8 @@ using namespace KMime::Headers; #define mk_header(hdr) \ - if (qstrnicmp(type, hdr ::staticType(), typeLen) == 0) \ - return new hdr + if (qstrnicmp(type, hdr ::staticType(), std::max(typeLen, strlen(hdr::staticType()))) == 0) \ + return new hdr; Headers::Base *HeaderFactory::createHeader(const char *type, size_t typeLen) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/src/kmime_util.cpp new/kmime-20.04.2/src/kmime_util.cpp --- old/kmime-20.04.1/src/kmime_util.cpp 2020-05-10 14:23:01.000000000 +0200 +++ new/kmime-20.04.2/src/kmime_util.cpp 2020-05-25 08:05:16.000000000 +0200 @@ -411,6 +411,30 @@ return LFtoCRLF(ret); } +QByteArray CRtoLF(const QByteArray &s) +{ + const int firstNewline = s.indexOf('\r'); + if (firstNewline == -1) { + return s; + } + if (firstNewline > 0 && (s.length() > firstNewline + 1) && s.at(firstNewline + 1) == '\n') { + // We found \r\n already, don't change anything + // This check assumes that input is consistent in terms of newlines, + // but so did if (s.contains("\r\n")), too. + return s; + } + + QByteArray ret = s; + ret.replace('\r', '\n'); + return ret; +} + +QByteArray CRtoLF(const char *s) +{ + const QByteArray ret = s; + return CRtoLF(ret); +} + namespace { template < typename StringType, typename CharType > void removeQuotesGeneric(StringType &str) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kmime-20.04.1/src/kmime_util.h new/kmime-20.04.2/src/kmime_util.h --- old/kmime-20.04.1/src/kmime_util.h 2020-05-10 14:23:01.000000000 +0200 +++ new/kmime-20.04.2/src/kmime_util.h 2020-05-25 08:05:16.000000000 +0200 @@ -150,6 +150,36 @@ KMIME_EXPORT extern QByteArray LFtoCRLF(const QByteArray &s); /** + Converts all occurrences of "\r" (CR) in @p s to "\n" (LF). + + This function is expensive and should be used only if the mail + will be stored locally. All decode functions can cope with both + line endings. + + @param s source string containing CR's + + @return the string with CR's substitued for LF's + @see CRtoLF(const QByteArray&) CRtoLF +*/ +KMIME_EXPORT extern QByteArray CRtoLF(const char *s); + +/** + Converts all occurrences of "\r" (CR) in @p s to "\n" (LF). + + This function is expensive and should be used only if the mail + will be transmitted as an RFC822 message later. All decode + functions can cope with and all encode functions can optionally + produce both line endings, which is much faster. + + @param s source string containing CR's + + @return the string with CR's substitued for LF's + @see CRtoLF(const QByteArray&) CRtoLF +*/ +KMIME_EXPORT extern QByteArray CRtoLF(const QByteArray &s); + + +/** Removes quote (DQUOTE) characters and decodes "quoted-pairs" (ie. backslash-escaped characters)
