From 79d60438e15a75d9d51555d9df595249352caa3a Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Fri, 1 May 2015 23:16:18 -0500 Subject: [PATCH] 5.4.1-12 - backport a couple more upstream fixes - introduce -common noarch subpkg, should help multilib issues --- ...PaperSize-regression-when-using-QPri.patch | 68 +++++++++++ ...adlock-when-the-lock-file-is-corrupt.patch | 113 ++++++++++++++++++ qt5-qtbase.spec | 23 +++- 3 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 0004-Fix-QPrinter-setPaperSize-regression-when-using-QPri.patch create mode 100644 0240-QLockFile-fix-deadlock-when-the-lock-file-is-corrupt.patch diff --git a/0004-Fix-QPrinter-setPaperSize-regression-when-using-QPri.patch b/0004-Fix-QPrinter-setPaperSize-regression-when-using-QPri.patch new file mode 100644 index 0000000..3b505c0 --- /dev/null +++ b/0004-Fix-QPrinter-setPaperSize-regression-when-using-QPri.patch @@ -0,0 +1,68 @@ +From 7fc8c560e21e7175b1fe33c988f3f30e4b326efe Mon Sep 17 00:00:00 2001 +From: David Faure +Date: Mon, 29 Dec 2014 16:37:55 +0100 +Subject: [PATCH 004/248] Fix QPrinter::setPaperSize regression when using + QPrinter::DevicePixel + +The QPageSize-based refactoring led to casting DevicePixel to a QPageSize::Unit +value of 6 (out of bounds). And then the switch in qt_nameForCustomSize +would leave the string empty, leading to "QString::arg: Argument missing: , 672" +warnings. + +Change-Id: I85e97174cc8ead9beccaaa3ded6edfad80f8e360 +Reviewed-by: Friedemann Kleint +Reviewed-by: Andy Shaw +--- + src/printsupport/kernel/qprinter.cpp | 5 ++++- + tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 12 +++++++++++- + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp +index 437a68e..8ed2732 100644 +--- a/src/printsupport/kernel/qprinter.cpp ++++ b/src/printsupport/kernel/qprinter.cpp +@@ -1224,7 +1224,10 @@ void QPrinter::setPageSize(PageSize newPageSize) + + void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit) + { +- setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); ++ if (unit == QPrinter::DevicePixel) ++ setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point)); ++ else ++ setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); + } + + /*! +diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +index 78aa0af..62bd982 100644 +--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp ++++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +@@ -526,7 +526,7 @@ void tst_QPrinter::testCustomPageSizes() + { + QPrinter p; + +- QSizeF customSize(8.5, 11.0); ++ QSizeF customSize(7.0, 11.0); + p.setPaperSize(customSize, QPrinter::Inch); + + QSizeF paperSize = p.paperSize(QPrinter::Inch); +@@ -538,6 +538,16 @@ void tst_QPrinter::testCustomPageSizes() + paperSize = p.paperSize(QPrinter::Inch); + QCOMPARE(paperSize.width(), customSize.width()); + QCOMPARE(paperSize.height(), customSize.height()); ++ ++ const QSizeF sizeInPixels = p.paperSize(QPrinter::DevicePixel); ++ QPrinter p3; ++ p3.setPaperSize(sizeInPixels, QPrinter::DevicePixel); ++ paperSize = p3.paperSize(QPrinter::Inch); ++ QCOMPARE(paperSize.width(), customSize.width()); ++ QCOMPARE(paperSize.height(), customSize.height()); ++ QPageSize pageSize = p3.pageLayout().pageSize(); ++ QCOMPARE(pageSize.key(), QString("Custom.504x792")); ++ QCOMPARE(pageSize.name(), QString("Custom (504pt x 792pt)")); + } + + void tst_QPrinter::customPaperSizeAndMargins_data() +-- +2.3.7 + diff --git a/0240-QLockFile-fix-deadlock-when-the-lock-file-is-corrupt.patch b/0240-QLockFile-fix-deadlock-when-the-lock-file-is-corrupt.patch new file mode 100644 index 0000000..cf84945 --- /dev/null +++ b/0240-QLockFile-fix-deadlock-when-the-lock-file-is-corrupt.patch @@ -0,0 +1,113 @@ +From f58e882b7594c59b6050d3c87562fcf836d10f60 Mon Sep 17 00:00:00 2001 +From: Olivier Goffart +Date: Tue, 14 Apr 2015 10:58:26 +0200 +Subject: [PATCH 240/248] QLockFile: fix deadlock when the lock file is + corrupted + +[ChangeLog][QtCore][QLockFile] Fixed a deadlock when the lock file +is corrupted. + +Task-number: QTBUG-44771 +Change-Id: Ic490b09d70ff1cc1733b64949889a73720b2d0f3 +Reviewed-by: David Faure +--- + src/corelib/io/qlockfile_unix.cpp | 10 +++++----- + src/corelib/io/qlockfile_win.cpp | 22 +++++++++++----------- + tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 17 +++++++++++++++++ + 3 files changed, 33 insertions(+), 16 deletions(-) + +diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp +index bf1015a..dc9f8f7 100644 +--- a/src/corelib/io/qlockfile_unix.cpp ++++ b/src/corelib/io/qlockfile_unix.cpp +@@ -181,11 +181,11 @@ bool QLockFilePrivate::isApparentlyStale() const + { + qint64 pid; + QString hostname, appname; +- if (!getLockInfo(&pid, &hostname, &appname)) +- return false; +- if (hostname.isEmpty() || hostname == QString::fromLocal8Bit(localHostName())) { +- if (::kill(pid, 0) == -1 && errno == ESRCH) +- return true; // PID doesn't exist anymore ++ if (getLockInfo(&pid, &hostname, &appname)) { ++ if (hostname.isEmpty() || hostname == QString::fromLocal8Bit(localHostName())) { ++ if (::kill(pid, 0) == -1 && errno == ESRCH) ++ return true; // PID doesn't exist anymore ++ } + } + const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime()); + return staleLockTime > 0 && age > staleLockTime; +diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp +index f9f2909..3587c7b 100644 +--- a/src/corelib/io/qlockfile_win.cpp ++++ b/src/corelib/io/qlockfile_win.cpp +@@ -115,21 +115,21 @@ bool QLockFilePrivate::isApparentlyStale() const + { + qint64 pid; + QString hostname, appname; +- if (!getLockInfo(&pid, &hostname, &appname)) +- return false; + + // On WinRT there seems to be no way of obtaining information about other + // processes due to sandboxing + #ifndef Q_OS_WINRT +- if (hostname == QString::fromLocal8Bit(localHostName())) { +- HANDLE procHandle = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); +- if (!procHandle) +- return true; +- // We got a handle but check if process is still alive +- DWORD dwR = ::WaitForSingleObject(procHandle, 0); +- ::CloseHandle(procHandle); +- if (dwR == WAIT_TIMEOUT) +- return true; ++ if (getLockInfo(&pid, &hostname, &appname)) { ++ if (hostname == QString::fromLocal8Bit(localHostName())) { ++ HANDLE procHandle = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); ++ if (!procHandle) ++ return true; ++ // We got a handle but check if process is still alive ++ DWORD dwR = ::WaitForSingleObject(procHandle, 0); ++ ::CloseHandle(procHandle); ++ if (dwR == WAIT_TIMEOUT) ++ return true; ++ } + } + #endif // !Q_OS_WINRT + const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime()); +diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +index 77bef94..12bea67 100644 +--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp ++++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +@@ -58,6 +58,7 @@ private slots: + void staleLongLockFromBusyProcess(); + void staleLockRace(); + void noPermissions(); ++ void corruptedLockFile(); + + public: + QString m_helperApp; +@@ -415,5 +416,21 @@ void tst_QLockFile::noPermissions() + QCOMPARE(int(lockFile.error()), int(QLockFile::PermissionError)); + } + ++void tst_QLockFile::corruptedLockFile() ++{ ++ const QString fileName = dir.path() + "/corruptedLockFile"; ++ ++ { ++ // Create a empty file. Typically the result of a computer crash or hard disk full. ++ QFile file(fileName); ++ QVERIFY(file.open(QFile::WriteOnly)); ++ } ++ ++ QLockFile secondLock(fileName); ++ secondLock.setStaleLockTime(100); ++ QVERIFY(secondLock.tryLock(10000)); ++ QCOMPARE(int(secondLock.error()), int(QLockFile::NoError)); ++} ++ + QTEST_MAIN(tst_QLockFile) + #include "tst_qlockfile.moc" +-- +2.3.7 + diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index a30e02d..a209f1e 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -37,7 +37,7 @@ Summary: Qt5 - QtBase components Name: qt5-qtbase Version: 5.4.1 -Release: 11%{?dist} +Release: 12%{?dist} # See LGPL_EXCEPTIONS.txt, for exception details License: LGPLv2 with exceptions or GPLv3 with exceptions @@ -98,12 +98,13 @@ Patch100: qtbase-opensource-src-5.4.0-QTBUG-43057.patch # Qt 5.5 patches Patch208: qt5-qtbase-5.5-Get_display_number_when_screen_number_is_omitted.patch - +Patch204: 0004-Fix-QPrinter-setPaperSize-regression-when-using-QPri.patch Patch212: 0012-Fix-a-crash-in-QPlainTextEdit-documentChanged.patch Patch272: 0072-CMake-Fix-QObject-connect-failing-on-ARM.patch Patch294: 0094-Fix-Meta-.-shortcuts-on-XCB.patch Patch332: 0132-Call-ofono-nm-Registered-delayed-in-constructor-othe.patch Patch336: 0136-Make-sure-there-s-a-scene-before-using-it.patch +Patch440: 0240-QLockFile-fix-deadlock-when-the-lock-file-is-corrupt.patch # http://lists.qt-project.org/pipermail/announce/2015-February/000059.html # CVE-2015-0295 Patch349: 0149-Fix-a-division-by-zero-when-processing-malformed-BMP.patch @@ -223,6 +224,7 @@ Conflicts: qt < 1:4.8.6-10 Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives %endif +Requires: %{name}-common = %{version}-%{release} ## Sql drivers %if 0%{?rhel} @@ -243,6 +245,13 @@ Qt is a software toolkit for developing applications. This package contains base tools, like string, xml, and network handling. +%package common +Summary: Common files for Qt5 +Requires: %{name} = %{version}-%{release} +BuildArch: noarch +%description common +%{summary}. + %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} @@ -361,6 +370,7 @@ rm -fv mkspecs/linux-g++*/qmake.conf.multilib-optflags %patch208 -p1 -b .ibus_get_display_number +%patch204 -p1 -b .0004 %patch212 -p1 -b .0012 %patch272 -p1 -b .0072 %patch294 -p1 -b .0094 @@ -369,6 +379,7 @@ rm -fv mkspecs/linux-g++*/qmake.conf.multilib-optflags %patch349 -p1 -b .0149 %patch400 -p1 -b .0200 %patch401 -p1 -b .0201 +%patch440 -p1 -b .0240 # drop -fexceptions from $RPM_OPT_FLAGS RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's|-fexceptions||g'` @@ -613,7 +624,6 @@ if [ $1 -eq 0 ]; then fi %endif - %files %doc LICENSE.LGPL* LGPL_EXCEPTION.txt %if 0%{?qtchooser} @@ -673,6 +683,9 @@ fi %{_qt5_plugindir}/sqldrivers/libqsqlite.so %{_qt5_libdir}/cmake/Qt5Sql/Qt5Sql_QSQLiteDriverPlugin.cmake +%files common +# empty for now, consider: filesystem/dir ownership, licenses + %if 0%{?docs} %files doc %doc LICENSE.FDL @@ -884,6 +897,10 @@ fi %changelog +* Fri May 01 2015 Rex Dieter - 5.4.1-12 +- backport a couple more upstream fixes +- introduce -common noarch subpkg, should help multilib issues + * Sat Apr 25 2015 Rex Dieter 5.4.1-11 - port qtdbusconnection_no_debug.patch from qt(4)