Bug#913287: libqt5core5a: loads libGL.so instead of libGL.so.1, causing PyQt5 to crash on systems with NVIDIA libraries installed

2018-11-09 Thread Julian Gilbey
On Fri, Nov 09, 2018 at 12:15:40AM +, Julian Gilbey wrote:
> It turns out that the bug lies in the libqt5core5a library, which
> tries loading libGL.so before trying libGL.so.1, which is the wrong
> order (in particular on Debian-based systems - see the above Debian
> bug report for a discussion of why).  I have created and tested the
> attached patch for the bug.
> 
> It would be great if this patch could be applied to Debian before
> buster is frozen; it probably won't make it into the upstream sources
> in time for buster (because it would presumably go into the 5.12.x
> tree).

Another thought: since on Debian-based systems, it is never correct to
dlopen("libGL.so"), the patch could even be simplified to only try
loading libGL.so.1 as follows:

--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -650,9 +650,7 @@
 #if QT_CONFIG(library)
 extern const QString qt_gl_library_name();
 //QLibrary lib(qt_gl_library_name());
-QLibrary lib(QLatin1String("GL"));
+QLibrary lib(QLatin1String("GL"), 1);
-if (!lib.load())
-lib.setFileNameAndVersion(QLatin1String("GL"), 1);
 glXGetProcAddressARB = (qt_glXGetProcAddressARB) 
lib.resolve("glXGetProcAddressARB");
 #endif
 }


Best wishes,

   Julian



Bug#913287: libqt5core5a: loads libGL.so instead of libGL.so.1, causing PyQt5 to crash on systems with NVIDIA libraries installed

2018-11-08 Thread Julian Gilbey
Package: libqt5core5a
Version: 5.11.2+dfsg-4
Severity: important
Tags: patch upstream

Hello,

A long-standing bug affects the PyQt5 (and previously the PyQt4)
packages, whereby they crash on Debian-based systems which have the
NVIDIA libraries installed.  The following almost minimal code
crashes:

#!/usr/bin/python3

import sys

from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView

app = QApplication(sys.argv)
wv = QWebEngineView()

wv.load(QUrl('about:blank'))
wv.show()

app.exec_()


See for example:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912925 
https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826

I have managed to track down the source of the error and reported it
upstream (along with debugging logs and so on) at:
https://bugreports.qt.io/browse/QTBUG-71488

It turns out that the bug lies in the libqt5core5a library, which
tries loading libGL.so before trying libGL.so.1, which is the wrong
order (in particular on Debian-based systems - see the above Debian
bug report for a discussion of why).  I have created and tested the
attached patch for the bug.

It would be great if this patch could be applied to Debian before
buster is frozen; it probably won't make it into the upstream sources
in time for buster (because it would presumably go into the 5.12.x
tree).

Thanks!

   Julian

-- System Information:
Debian Release: buster/sid
  APT prefers stretch
  APT policy: (500, 'stretch'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_GB.UTF-8), LANGUAGE=en_GB.utf8 (charmap=UTF-8) (ignored: LC_ALL set 
to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libqt5core5a depends on:
ii  libc6  2.27-8
ii  libdouble-conversion1  3.1.0-2
ii  libgcc11:8.2.0-9
ii  libglib2.0-0   2.58.1-2
ii  libicu60   60.2-6
ii  libpcre2-16-0  10.32-3
ii  libstdc++6 8.2.0-9
ii  zlib1g 1:1.2.11.dfsg-1

Versions of packages libqt5core5a recommends:
ii  qttranslations5-l10n  5.11.2-2

Versions of packages libqt5core5a suggests:
ii  libthai0  0.1.28-1

-- no debconf information
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -650,9 +650,9 @@
 #if QT_CONFIG(library)
 extern const QString qt_gl_library_name();
 //QLibrary lib(qt_gl_library_name());
-QLibrary lib(QLatin1String("GL"));
+QLibrary lib(QLatin1String("GL"), 1);
 if (!lib.load())
-lib.setFileNameAndVersion(QLatin1String("GL"), 1);
+lib.setFileName(QLatin1String("GL"));
 glXGetProcAddressARB = (qt_glXGetProcAddressARB) 
lib.resolve("glXGetProcAddressARB");
 #endif
 }