qt4: Fix moc parsing glibc-2.25+ system headers (closes FS#1666)

Add upstream patches:
    - Fix moc parsing correctly glibc 2.25+ system headers
    - 0001-Fix-exclusion-of-anonymous-ciphers.patch -- Exclude more ciphers from being used by default
    - fix-medium-font.diff --  fix bolder fonts in qt4 apps [QTBUG#27301]
    - fix_assistant_segfault_QTBUG-25324.patch [QTBUG#25324]
This commit is contained in:
Predrag Ivanović 2018-06-08 17:35:37 +02:00 committed by Fredrik Rinnestam
parent 78d4ff4bb7
commit 062fdbdbb9
8 changed files with 218 additions and 8 deletions

View File

@ -3443,6 +3443,9 @@ drwxr-xr-x root/root usr/share/qt4/plugins/script/
-rwxr-xr-x root/root usr/share/qt4/plugins/script/libqtscriptdbus.so
drwxr-xr-x root/root usr/share/qt4/plugins/sqldrivers/
-rwxr-xr-x root/root usr/share/qt4/plugins/sqldrivers/libqsqlite.so
-rwxr-xr-x root/root usr/share/qt4/plugins/sqldrivers/libqsqlodbc.so
-rwxr-xr-x root/root usr/share/qt4/plugins/sqldrivers/libqsqlpsql.so
-rwxr-xr-x root/root usr/share/qt4/plugins/sqldrivers/libqsqltds.so
-rw-r--r-- root/root usr/share/qt4/q3porting.xml
drwxr-xr-x root/root usr/share/qt4/tests/
drwxr-xr-x root/root usr/share/qt4/tests/qt4/

View File

@ -1,2 +1,6 @@
44b790ca875f6c795a6d3db86f2eb4a3 0001-Fix-exclusion-of-anonymous-ciphers.patch
c683842fd5dc29620b8667ca541defd9 fix-medium-font.diff
bdfbee805678ab0f253e54aadb64f366 fix-moc-parsing-with-glibc-2.25.patch
07c66abed89aa67609170ab957ad32af fix_assistant_segfault_QTBUG-25324.patch
e10fad1c1b0c5e958ec51fd69b792d7a qt-everywhere-opensource-src-4.8.7-gcc6.patch
d990ee66bf7ab0c785589776f35ba6ad qt-everywhere-opensource-src-4.8.7.tar.gz

View File

@ -1,6 +0,0 @@
untrusted comment: verify with /etc/ports/opt.pub
RWSE3ohX2g5d/UsSkoZQUCrkGKT22sW4HPudc9BL0DoBb6OPm4e2TBt3+DXqA5KuegCZ4PFOnpW9QiRPBGs/gRzOKBg4f53IBgE=
SHA256 (Pkgfile) = 9ded5d2b80db21668c59746c6e9d9c3e165e3921732575c14f0561231d6ca9a7
SHA256 (.footprint) = 254ff8e725593951bbef43fd94bf7755726daedbacdf7fdc6df9f82d4b50e4c9
SHA256 (qt-everywhere-opensource-src-4.8.7.tar.gz) = e2882295097e47fe089f8ac741a95fef47e0a73a3f3cdf21b56990638f626ea0
SHA256 (qt-everywhere-opensource-src-4.8.7-gcc6.patch) = 57b67e6c860f11a876aaf93111728d67842dccaa23cb919826038b4fd88fd6ca

View File

@ -0,0 +1,33 @@
From 479e84dcbd0d7f1333105c495d7931f1bef3e63b Mon Sep 17 00:00:00 2001
From: "Richard J. Moore" <rich@kde.org>
Date: Sat, 18 Apr 2015 12:44:30 +0100
Subject: [PATCH] Fix exclusion of anonymous ciphers.
Qt attempted to exclude anonymous ciphers since they offer no MITM
protection, but missed export ADH ciphers and AECDH from the exclude
list.
Change-Id: Icdfa9b31643a0e9927010885c7c1d02c42460d79
Reviewed-by: Peter Hartmann <peter-qt@hartmann.tk>
---
src/network/ssl/qsslsocket_openssl.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index ce98494..00b2b9e 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -662,7 +662,10 @@ void QSslSocketPrivate::resetDefaultCiphers()
if (cipher->valid) {
QSslCipher ciph = QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(cipher);
if (!ciph.isNull()) {
- if (!ciph.name().toLower().startsWith(QLatin1String("adh")))
+ // Unconditionally exclude ADH and AECDH ciphers since they offer no MITM protection
+ if (!ciph.name().toLower().startsWith(QLatin1String("adh")) &&
+ !ciph.name().toLower().startsWith(QLatin1String("exp-adh")) &&
+ !ciph.name().toLower().startsWith(QLatin1String("aecdh")))
ciphers << ciph;
}
}
--
2.6.2

View File

@ -5,9 +5,13 @@
name=qt4
version=4.8.7
release=3
release=4
source=(http://download.qt-project.org/official_releases/qt/${version%.*}/$version/qt-everywhere-opensource-src-$version.tar.gz \
qt-everywhere-opensource-src-4.8.7-gcc6.patch)
qt-everywhere-opensource-src-4.8.7-gcc6.patch
0001-Fix-exclusion-of-anonymous-ciphers.patch
fix_assistant_segfault_QTBUG-25324.patch
fix-moc-parsing-with-glibc-2.25.patch
fix-medium-font.diff)
build () {
cd qt-everywhere-opensource-src-$version
@ -18,6 +22,10 @@ build () {
sed -i "s|INSTALLS += translations||" projects.pro
sed -i 's|"$COMPILER" -c|$COMPILER -c|' config.tests/unix/fvisibility.test
patch -p1 -i $SRC/0001-Fix-exclusion-of-anonymous-ciphers.patch
patch -p1 -i $SRC/fix_assistant_segfault_QTBUG-25324.patch
patch -p1 -i $SRC/fix-moc-parsing-with-glibc-2.25.patch
patch -p1 -i $SRC/fix-medium-font.diff
patch -p1 -i $SRC/qt-everywhere-opensource-src-4.8.7-gcc6.patch
export CXXFLAGS="$CXXFLAGS -std=gnu++98 -Wno-deprecated"

105
qt4/fix-medium-font.diff Normal file
View File

@ -0,0 +1,105 @@
From: Ken VanDine <ken.vandine@canonical.com>
Description: Default to regular font in X11
Default to Regular/Normal instead of Medium in QFontDatabase for X11.
.
Tweak the buckets so that Medium has preference over Bold when DemiBold
is requested.
Bug-Ubuntu: https://launchpad.net/bugs/744812
Bug: https://bugreports.qt-project.org/browse/QTBUG-27301
Forwarded: https://codereview.qt-project.org/#change,35591
Author: Michał Sawicz<michal.sawicz@canonical.com>
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -729,10 +729,17 @@
static int getFCWeight(int fc_weight)
{
int qtweight = QFont::Black;
- if (fc_weight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_MEDIUM) / 2)
+ if (fc_weight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_REGULAR) / 2)
qtweight = QFont::Light;
- else if (fc_weight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2)
+ else if (fc_weight <= (FC_WEIGHT_REGULAR + FC_WEIGHT_MEDIUM) / 2)
qtweight = QFont::Normal;
+#if 0
+ // FIXME: Uncomment this when it's safe to expand the Enum to include ::Medium
+ // Will map Medium to DemiBold via fallthrough for the moment,
+ // but avoids API/ABI break
+ else if (fc_weight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2)
+ qtweight = QFont::Medium;
+#endif
else if (fc_weight <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD) / 2)
qtweight = QFont::DemiBold;
else if (fc_weight <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK) / 2)
@@ -772,9 +779,13 @@
fontDef.styleHint
*/
+ // Default to Regular and thus to the common case. Previous
+ // versions of Qt requested Medium as default. This is fine until
+ // a Medium weight is actually provided by a font, and so gets
+ // promoted to bold fallthrough.
int weight;
if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) != FcResultMatch)
- weight = FC_WEIGHT_MEDIUM;
+ weight = FC_WEIGHT_REGULAR;
fontDef.weight = getFCWeight(weight);
int slant;
@@ -1066,16 +1077,19 @@
// capitalize(value);
familyName = QString::fromUtf8((const char *)value);
slant_value = FC_SLANT_ROMAN;
- weight_value = FC_WEIGHT_MEDIUM;
+ weight_value = FC_WEIGHT_REGULAR;
spacing_value = FC_PROPORTIONAL;
file_value = 0;
index_value = 0;
scalable = FcTrue;
+ // Fallthroughs in case a match was not found. In previous
+ // versions of Qt, Medium was requested from FontConfig,
+ // leading to a promotion from Medium to Bold.
if (FcPatternGetInteger (fonts->fonts[i], FC_SLANT, 0, &slant_value) != FcResultMatch)
slant_value = FC_SLANT_ROMAN;
if (FcPatternGetInteger (fonts->fonts[i], FC_WEIGHT, 0, &weight_value) != FcResultMatch)
- weight_value = FC_WEIGHT_MEDIUM;
+ weight_value = FC_WEIGHT_REGULAR;
if (FcPatternGetInteger (fonts->fonts[i], FC_SPACING, 0, &spacing_value) != FcResultMatch)
spacing_value = FC_PROPORTIONAL;
if (FcPatternGetString (fonts->fonts[i], FC_FILE, 0, &file_value) != FcResultMatch)
@@ -1487,14 +1501,32 @@
}
int weight_value = FC_WEIGHT_BLACK;
+ // Default and request Regular font weight if none specified
+ // Previous versions of Qt default to requesting Medium, even
+ // though this weight does not typically exist.
if (request.weight == 0)
- weight_value = FC_WEIGHT_MEDIUM;
+ weight_value = FC_WEIGHT_REGULAR;
else if (request.weight < (QFont::Light + QFont::Normal) / 2)
weight_value = FC_WEIGHT_LIGHT;
- else if (request.weight < (QFont::Normal + QFont::DemiBold) / 2)
+#if 0
+ // FIXME: Avoid ABI Break; active this full codepath when
+ // QFont::Medium enum is available in the future
+ else if (request.weight < (QFont::Normal + QFont::Medium) / 2)
+ weight_value = FC_WEIGHT_REGULAR;
+ else if (request.weight < (QFont::Medium + QFont::DemiBold) / 2)
weight_value = FC_WEIGHT_MEDIUM;
else if (request.weight < (QFont::DemiBold + QFont::Bold) / 2)
weight_value = FC_WEIGHT_DEMIBOLD;
+#else
+ // For the moment This may still not full-circle correctly; via
+ // Medium->DemiBold->Bold promotion. However It's hard to do much
+ // about this without an ABI/API tweak to include the fuller set
+ // of standard TTF/CSS/FontConfig weights.
+ else if (request.weight < (QFont::Normal + QFont::DemiBold) / 2)
+ weight_value = FC_WEIGHT_REGULAR;
+ else if (request.weight < (QFont::DemiBold + QFont::Bold) / 2)
+ weight_value = (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2;
+#endif
else if (request.weight < (QFont::Bold + QFont::Black) / 2)
weight_value = FC_WEIGHT_BOLD;
FcPatternDel(pattern, FC_WEIGHT);

View File

@ -0,0 +1,49 @@
Fixes moc parsing of (#__VA_ARGS__) expressions
glibc 2.25 introduced code like the following in
/usr/include/sys/sysmacros.h:
#define __SYSMACROS_DM(symbol) __SYSMACROS_DM1 \
(In the GNU C Library, symbol is defined\n\
by <sys/sysmacros.h>. For historical compatibility, it is\n\
currently defined by <sys/types.h> as well, but we plan to\n\
remove this soon. To use #symbol, include <sys/sysmacros.h>\n\
directly. If you did not intend to use a system-defined macro\n\
#symbol, you should undefine it after including <sys/types.h>.)
(where __SYSMACROS_DM1 is defined as:
#define __SYSMACROS_DM1(...) __glibc_macro_warning (#__VA_ARGS__)
)
when parsing that with moc, it gives the following parse error:
/usr/include/glib-2.0/gobject/gtype.h:52: Parse error at "defined"
This patch fixes this, so it ignores arguments passed to
(#__VA_ARGS__) since they're supposed to be strings anyway.
Index: qt-everywhere-opensource-src-4.8.7/src/tools/moc/preprocessor.cpp
===================================================================
--- qt-everywhere-opensource-src-4.8.7.orig/src/tools/moc/preprocessor.cpp
+++ qt-everywhere-opensource-src-4.8.7/src/tools/moc/preprocessor.cpp
@@ -535,6 +535,21 @@ void Preprocessor::substituteUntilNewlin
MacroName macro = symbol();
if (macros.contains(macro) && !safeset.contains(macro)) {
substituteMacro(macro, substituted, safeset);
+ if (substituted.count()>4)
+ {
+ int i=substituted.count()-4;
+ if (substituted.at(i).lexem()=="("
+ && substituted.at(i+1).lexem()=="#"
+ && substituted.at(i+2).lexem()=="__VA_ARGS__"
+ && substituted.at(i+3).lexem()==")")
+ {
+ // Let's ignore the following expression, since it'll considered a string, and so, it's better not to parse it.
+ if (test(PP_LPAREN)) {
+ while (!test(PP_RPAREN)) next();
+ }
+
+ }
+ }
continue;
}
} else if (token == PP_DEFINED) {

View File

@ -0,0 +1,14 @@
Index: qt-everywhere-opensource-src-4.8.3/tools/assistant/tools/assistant/mainwindow.cpp
===================================================================
--- qt-everywhere-opensource-src-4.8.3.orig/tools/assistant/tools/assistant/mainwindow.cpp
+++ qt-everywhere-opensource-src-4.8.3/tools/assistant/tools/assistant/mainwindow.cpp
@@ -945,8 +945,7 @@ void MainWindow::updateApplicationFont()
if (helpEngine.usesAppFont())
font = helpEngine.appFont();
- const QWidgetList &widgets = qApp->allWidgets();
- foreach (QWidget* widget, widgets)
+ foreach (QWidget* widget, QApplication::allWidgets())
widget->setFont(font);
}