[kdelibs] backport a few upstream fixes

Rex Dieter rdieter at fedoraproject.org
Fri Oct 18 13:48:36 UTC 2013


commit a4e7e17e687692da4c76b9dad7e55124b1b84d54
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Fri Oct 18 08:48:35 2013 -0500

    backport a few upstream fixes

 ...or-handling-when-writing-to-the-kdeinit4-.patch |   98 ++++++++++++++
 ...slation-functions-for-js-QScriptEngine-sc.patch |   39 ++++++
 ...x-association-with-derived-mimetype-again.patch |  141 ++++++++++++++++++++
 kdelibs.spec                                       |   13 ++-
 4 files changed, 290 insertions(+), 1 deletions(-)
---
diff --git a/0002-Improve-error-handling-when-writing-to-the-kdeinit4-.patch b/0002-Improve-error-handling-when-writing-to-the-kdeinit4-.patch
new file mode 100644
index 0000000..29d96f2
--- /dev/null
+++ b/0002-Improve-error-handling-when-writing-to-the-kdeinit4-.patch
@@ -0,0 +1,98 @@
+From c0af4b9506e4bacd4e70342d5668ccb9c8a7203c Mon Sep 17 00:00:00 2001
+From: David Faure <faure at kde.org>
+Date: Sun, 29 Sep 2013 11:57:32 +0200
+Subject: [PATCH 02/12] Improve error handling when writing to the kdeinit4
+ socket.
+
+Loop on EINTR, and print out an error message on failure.
+---
+ kinit/klauncher.cpp | 31 ++++++++++++++++++++++++-------
+ 1 file changed, 24 insertions(+), 7 deletions(-)
+
+diff --git a/kinit/klauncher.cpp b/kinit/klauncher.cpp
+index 0e055f5..6c71e99 100644
+--- a/kinit/klauncher.cpp
++++ b/kinit/klauncher.cpp
+@@ -38,6 +38,7 @@
+ #endif
+ 
+ #include <QtCore/QFile>
++#include <qplatformdefs.h>
+ 
+ #include <kconfig.h>
+ #include <kdebug.h>
+@@ -171,6 +172,22 @@ IdleSlave::age(time_t now) const
+ 
+ static KLauncher* g_klauncher_self;
+ 
++
++// From qcore_unix_p.h. We could also port to QLocalSocket :)
++#define K_EINTR_LOOP(var, cmd)                    \
++    do {                                        \
++        var = cmd;                              \
++    } while (var == -1 && errno == EINTR)
++
++ssize_t kde_safe_write(int fd, const void *buf, size_t count)
++{
++    ssize_t ret = 0;
++    K_EINTR_LOOP(ret, QT_WRITE(fd, buf, count));
++    if (ret < 0)
++        qWarning() << "write failed:" << strerror(errno);
++    return ret;
++}
++
+ #ifndef USE_KPROCESS_FOR_KIOSLAVES
+ KLauncher::KLauncher(int _kdeinitSocket)
+   : QObject(0),
+@@ -232,7 +249,7 @@ KLauncher::KLauncher()
+    klauncher_header request_header;
+    request_header.cmd = LAUNCHER_OK;
+    request_header.arg_length = 0;
+-   write(kdeinitSocket, &request_header, sizeof(request_header));
++   kde_safe_write(kdeinitSocket, &request_header, sizeof(request_header));
+ #endif
+ }
+ 
+@@ -270,8 +287,8 @@ void KLauncher::setLaunchEnv(const QString &name, const QString &value)
+    requestData.append(name.toLocal8Bit()).append('\0').append(value.toLocal8Bit()).append('\0');
+    request_header.cmd = LAUNCHER_SETENV;
+    request_header.arg_length = requestData.size();
+-   write(kdeinitSocket, &request_header, sizeof(request_header));
+-   write(kdeinitSocket, requestData.data(), request_header.arg_length);
++   kde_safe_write(kdeinitSocket, &request_header, sizeof(request_header));
++   kde_safe_write(kdeinitSocket, requestData.data(), request_header.arg_length);
+ #else
+    Q_UNUSED(name);
+    Q_UNUSED(value);
+@@ -694,8 +711,8 @@ KLauncher::requestStart(KLaunchRequest *request)
+                 << "cmd=" << commandToString(request_header.cmd);
+ #endif
+ 
+-   write(kdeinitSocket, &request_header, sizeof(request_header));
+-   write(kdeinitSocket, requestData.data(), requestData.length());
++   kde_safe_write(kdeinitSocket, &request_header, sizeof(request_header));
++   kde_safe_write(kdeinitSocket, requestData.data(), requestData.length());
+ 
+    // Wait for pid to return.
+    lastRequest = request;
+@@ -1161,7 +1178,7 @@ KLauncher::requestSlave(const QString &protocol,
+        klauncher_header request_header;
+        request_header.cmd = LAUNCHER_DEBUG_WAIT;
+        request_header.arg_length = 0;
+-       write(kdeinitSocket, &request_header, sizeof(request_header));
++       kde_safe_write(kdeinitSocket, &request_header, sizeof(request_header));
+ #else
+       name = QString::fromLatin1("gdb");
+ #endif
+@@ -1343,7 +1360,7 @@ void KLauncher::terminate_kdeinit()
+     klauncher_header request_header;
+     request_header.cmd = LAUNCHER_TERMINATE_KDEINIT;
+     request_header.arg_length = 0;
+-    write(kdeinitSocket, &request_header, sizeof(request_header));
++    kde_safe_write(kdeinitSocket, &request_header, sizeof(request_header));
+ #endif
+ }
+ 
+-- 
+1.8.3.1
+
diff --git a/0010-Enable-translation-functions-for-js-QScriptEngine-sc.patch b/0010-Enable-translation-functions-for-js-QScriptEngine-sc.patch
new file mode 100644
index 0000000..65ecfb7
--- /dev/null
+++ b/0010-Enable-translation-functions-for-js-QScriptEngine-sc.patch
@@ -0,0 +1,39 @@
+From 61c81131867af964496780cbc0adda4bfc55c7cf Mon Sep 17 00:00:00 2001
+From: Luigi Toscano <luigi.toscano at tiscali.it>
+Date: Mon, 14 Oct 2013 19:36:20 +0200
+Subject: [PATCH 10/12] Enable translation functions for js/QScriptEngine
+ scripts
+
+REVIEW: 113218
+---
+ kross/qts/main.cpp   | 1 +
+ kross/qts/script.cpp | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/kross/qts/main.cpp b/kross/qts/main.cpp
+index 041c306..f40c044 100644
+--- a/kross/qts/main.cpp
++++ b/kross/qts/main.cpp
+@@ -83,6 +83,7 @@ int main(int argc, char **argv)
+ 
+     app = new KApplication( /* GUIenabled */ true );
+     QScriptEngine* engine = new QScriptEngine();
++    engine->installTranslatorFunctions();
+     QScriptValue global = engine->globalObject();
+ 
+     //qDebug()<<"QLibraryInfo::PluginsPath="<<QLibraryInfo::location(QLibraryInfo::PluginsPath);
+diff --git a/kross/qts/script.cpp b/kross/qts/script.cpp
+index 41d46b2..1cee907 100644
+--- a/kross/qts/script.cpp
++++ b/kross/qts/script.cpp
+@@ -48,6 +48,7 @@ namespace Kross {
+ 
+                 delete m_engine;
+                 m_engine = new QScriptEngine();
++                m_engine->installTranslatorFunctions();
+ 
+                 // load the Kross QScriptExtensionPlugin plugin that provides
+                 // us a bridge between Kross and QtScript. See here plugin.h
+-- 
+1.8.3.1
+
diff --git a/0012-Fix-association-with-derived-mimetype-again.patch b/0012-Fix-association-with-derived-mimetype-again.patch
new file mode 100644
index 0000000..19907c7
--- /dev/null
+++ b/0012-Fix-association-with-derived-mimetype-again.patch
@@ -0,0 +1,141 @@
+From f723e2e7d36b597c5262bf63dde380d89ec6bfcb Mon Sep 17 00:00:00 2001
+From: David Faure <faure at kde.org>
+Date: Fri, 18 Oct 2013 09:44:17 +0200
+Subject: [PATCH 12/12] Fix association-with-derived-mimetype again.
+
+871cccc8a88a made it impossible to re-order file type associations.
+7f42bf253009 fixed that, but changed the value of KService::mimeTypes(), which
+broke okular. This new fix works the same way, but only inside kbuildsycoca
+when it processes the mimetypes. The value of KService::mimeTypes() is now
+restored to be exactly what's in the desktop file.
+
+CCBUG: 321706
+FIXED-IN: 4.11.3
+---
+ kdecore/services/kservice.cpp  | 45 +++++++++---------------------------------
+ kdecore/tests/kservicetest.cpp |  7 ++++---
+ kded/kbuildservicefactory.cpp  | 11 ++++++++++-
+ 3 files changed, 23 insertions(+), 40 deletions(-)
+
+diff --git a/kdecore/services/kservice.cpp b/kdecore/services/kservice.cpp
+index d7945bf..8e81929 100644
+--- a/kdecore/services/kservice.cpp
++++ b/kdecore/services/kservice.cpp
+@@ -227,44 +227,17 @@ void KServicePrivate::init( const KDesktopFile *config, KService* q )
+                            << "has an empty mimetype!";
+             continue;
+         }
+-
+-        // The following searches through the list for duplicate, inherited mimetypes
+-        // For example, if application/rtf and text/plain are both listed application/rtf is removed
+-        // since it is inherited from text/plain
+-        // This is a reworked fix for revision 871cccc8a88a600c8f850a020d44bfc5f5858caa
+-        bool shouldAdd = true;
+-        KMimeType::Ptr mimeType1 = KMimeTypeRepository::self()->findMimeTypeByName(st);
+-        if (mimeType1) {
+-            foreach(const QString mime2, lstServiceTypes) {
+-                // Don't compare the mimetype with itself
+-                if (st == mime2) {
+-                    continue;
+-                }
+-
+-                // is checks for inheritance and aliases, so this should suffice
+-                if (mimeType1->is(mime2)) {
+-                    shouldAdd = false;
+-                    break;
+-                }
++        int initialPreference = m_initialPreference;
++        if ( st_it.hasNext() ) {
++            // TODO better syntax - separate group with mimetype=number entries?
++            bool isNumber;
++            const int val = st_it.peekNext().toInt(&isNumber);
++            if (isNumber) {
++                initialPreference = val;
++                st_it.next();
+             }
+         }
+-
+-        // Only add unique mimetypes
+-        if (shouldAdd) {
+-            int initialPreference = m_initialPreference;
+-            if (st_it.hasNext()) {
+-                // TODO better syntax - separate group with mimetype=number entries?
+-                bool isNumber;
+-                const int val = st_it.peekNext().toInt(&isNumber);
+-                if (isNumber) {
+-                    initialPreference = val;
+-                    st_it.next();
+-                }
+-            }
+-            m_serviceTypes.push_back(KService::ServiceTypeAndPreference(initialPreference, st));
+-        } else {
+-            //kDebug(servicesDebugArea())<<"Not adding"<<st<<"from"<<entryPath;
+-        }
++        m_serviceTypes.push_back(KService::ServiceTypeAndPreference(initialPreference, st));
+     }
+ 
+     if (entryMap.contains(QLatin1String("Actions"))) {
+diff --git a/kdecore/tests/kservicetest.cpp b/kdecore/tests/kservicetest.cpp
+index 0dba8d9..7371475 100644
+--- a/kdecore/tests/kservicetest.cpp
++++ b/kdecore/tests/kservicetest.cpp
+@@ -91,7 +91,7 @@ void KServiceTest::initTestCase()
+ 	group.writeEntry("X-KDE-Library", "fakepart");
+ 	group.writeEntry("X-KDE-Protocols", "http,ftp");
+ 	group.writeEntry("X-KDE-ServiceTypes", "KParts/ReadOnlyPart,Browser/View,KParts/ReadWritePart");
+-	group.writeEntry("MimeType", "text/plain;");
++	group.writeEntry("MimeType", "text/plain;text/html;");
+     }
+ 
+     // faketextplugin: a ktexteditor plugin
+@@ -168,6 +168,7 @@ void KServiceTest::testProperty()
+     KService::Ptr fakePart = KService::serviceByDesktopPath("fakepart.desktop");
+     QVERIFY(fakePart); // see initTestCase; it should be found.
+     QVERIFY(fakePart->propertyNames().contains("X-KDE-Protocols"));
++    QCOMPARE(fakePart->mimeTypes(), QStringList() << "text/plain" << "text/html"); // okular relies on subclasses being kept here
+     const QStringList protocols = fakePart->property("X-KDE-Protocols").toStringList();
+     QCOMPARE(protocols, QStringList() << "http" << "ftp");
+ }
+@@ -356,7 +357,7 @@ void KServiceTest::testHasServiceType1() // with services constructed with a ful
+     KService fakepart( fakepartPath );
+     QVERIFY( fakepart.hasServiceType( "KParts/ReadOnlyPart" ) );
+     QVERIFY( fakepart.hasServiceType( "KParts/ReadWritePart" ) );
+-    QCOMPARE(fakepart.mimeTypes(), QStringList() << "text/plain");
++    QCOMPARE(fakepart.mimeTypes(), QStringList() << "text/plain" << "text/html");
+ 
+     QString faketextPluginPath = KStandardDirs::locate( "services", "faketextplugin.desktop" );
+     QVERIFY( !faketextPluginPath.isEmpty() );
+@@ -371,7 +372,7 @@ void KServiceTest::testHasServiceType2() // with services coming from ksycoca
+     QVERIFY( !fakepart.isNull() );
+     QVERIFY( fakepart->hasServiceType( "KParts/ReadOnlyPart" ) );
+     QVERIFY( fakepart->hasServiceType( "KParts/ReadWritePart" ) );
+-    QCOMPARE(fakepart->mimeTypes(), QStringList() << "text/plain");
++    QCOMPARE(fakepart->mimeTypes(), QStringList() << "text/plain" << "text/html");
+ 
+     KService::Ptr faketextPlugin = KService::serviceByDesktopPath( "faketextplugin.desktop" );
+     QVERIFY( !faketextPlugin.isNull() );
+diff --git a/kded/kbuildservicefactory.cpp b/kded/kbuildservicefactory.cpp
+index 5fb091b..b4564bd 100644
+--- a/kded/kbuildservicefactory.cpp
++++ b/kded/kbuildservicefactory.cpp
+@@ -267,7 +267,16 @@ void KBuildServiceFactory::populateServiceTypes()
+                         continue;
+                     }
+                 } else {
+-                    m_offerHash.addServiceOffer(mime->name(), offer); // mime->name so that we resolve aliases
++                    bool shouldAdd = true;
++                    foreach (const QString &otherType, service->serviceTypes()) {
++                        if (stName != otherType && mime->is(otherType)) {
++                            shouldAdd = false;
++                        }
++                    }
++                    if (shouldAdd) {
++                        //kDebug(7021) << "Adding service" << service->entryPath() << "to" << mime->name();
++                        m_offerHash.addServiceOffer(mime->name(), offer); // mime->name so that we resolve aliases
++                    }
+                 }
+             }
+         }
+-- 
+1.8.3.1
+
diff --git a/kdelibs.spec b/kdelibs.spec
index 7b363da..027de02 100644
--- a/kdelibs.spec
+++ b/kdelibs.spec
@@ -38,7 +38,7 @@ Source10: SOLID_HAL_LEGACY.sh
 
 Summary: KDE Libraries
 Version: 4.11.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 Name: kdelibs
 Epoch: 6
@@ -164,6 +164,10 @@ Patch092: return-application-icons-properly.patch
 # revert disabling of packagekit
 Patch093: turn-the-packagekit-support-feature-off-by-default.patch
 
+Patch102: 0002-Improve-error-handling-when-writing-to-the-kdeinit4-.patch
+Patch110: 0010-Enable-translation-functions-for-js-QScriptEngine-sc.patch
+Patch112: 0012-Fix-association-with-derived-mimetype-again.patch
+
 ## security fix
 
 # rhel patches
@@ -356,6 +360,10 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
 %patch092 -p1 -R -b .return-application-icons-properly
 %patch093 -p1 -R -b .turn-the-packagekit-support-feature-off-by-default
 
+%patch102 -p1 -b .0002
+%patch110 -p1 -b .0010
+%patch112 -p1 -b .0012
+
 # security fixes
 
 # rhel patches
@@ -604,6 +612,9 @@ gtk-update-icon-cache %{_kde4_iconsdir}/hicolor &> /dev/null || :
 
 
 %changelog
+* Fri Oct 18 2013 Rex Dieter <rdieter at fedoraproject.org> - 6:4.11.2-2
+- backport a few upstream fixes
+
 * Sat Sep 28 2013 Rex Dieter <rdieter at fedoraproject.org> - 6:4.11.2-1
 - 4.11.2
 


More information about the scm-commits mailing list