[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1033995: qtbase-opensource-src: Fix accessibility of qt5 applications run as root



Hi Samuel!

On Thu, Apr 06, 2023 at 01:57:25AM +0200, Samuel Thibault wrote:
> Hello,
>
> Currently, qt5 applications, when run in sudo, are not accessible to
> screen readers. This is because the accessibility layer does not manage
> to connect to the accessibility bus to export the application content:
>
> https://bugreports.qt.io/browse/QTBUG-43674
>
> [...]
>
> This is particularly important because the calamares installer is based
> on qt5 and runs as root, and it currently is completely inaccessible to
> blind users, and this fix makes it possible for blind users to use it.
>
> I have confirmed that this fixes the issue for bookworm, would it be
> possible to upload to unstable? I'll then handle requesting the unblock
> from the release team.

I understand the importance of this patch, but I don't like that this change
has not been merged upstream because of test failures, and did not have any
activity for the last 5 years.

But I looked at the KDE branch, and the last three commits they have there [1]
seem to be related to the same problem. At least, the comment talks about the
the same thing as your description:

    // Only connect on next loop run, connections to our enabled signal are
    // only established after the ctor returns.

But these changes depend on AT_SPI_BUS_ADDRESS environment variable. Can we
rely on it in Debian? If yes, can you please check if those commits fix the
issue with calamares? I have attached them as a single patch for convenience.

[1]: https://invent.kde.org/qt/qt/qtbase/-/commits/kde/5.15/src/platformsupport/linuxaccessibility/dbusconnection.cpp

--
Dmitry Shachnev
diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
index 45ddc8e496..cc734abc63 100644
--- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp
+++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
@@ -69,6 +69,21 @@ QT_BEGIN_NAMESPACE
 DBusConnection::DBusConnection(QObject *parent)
     : QObject(parent), m_a11yConnection(QString()), m_enabled(false)
 {
+    // If the bus is explicitly set via env var it overrides everything else.
+    QByteArray addressEnv = qgetenv("AT_SPI_BUS_ADDRESS");
+    if (!addressEnv.isEmpty()) {
+        // Only connect on next loop run, connections to our enabled signal are
+        // only established after the ctor returns.
+        QMetaObject::invokeMethod(
+                this,
+                [this, addressEnv] {
+                    m_enabled = true;
+                    connectA11yBus(QString::fromLocal8Bit(addressEnv));
+                },
+                Qt::QueuedConnection);
+        return;
+    }
+
     // Start monitoring if "org.a11y.Bus" is registered as DBus service.
     QDBusConnection c = QDBusConnection::sessionBus();
     if (!c.isConnected()) {

Attachment: signature.asc
Description: PGP signature


Reply to: