Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-132448

QGenericUnixServices::openUrl() calls kde-open with the applications LD_LIBRARY_PATH

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.0, 6.5, 6.9
    • QPA: Wayland, QPA: X11/XCB
    • None
    • Linux/Yocto

    Description

      QGenericUnixServices::openUrl() calls xdg-open.
      In a KDE environment this ends up in kde-open, which depends on Qt.
      QDesktopServices::openUrl() fails, when

      • called from an App that has been compiled against a more recent Qt version than kde-open, and
      • the app sets LD_LIBRARY_PATH to point at the (newer) Qt version against which it was built.

      The reason is that xdg-open is called by the static QProcess::startDetached(), which inherits the application's process environment. That makes no sense. A desktop service should be called with LD_LIBRARY_PATH unset.

      That can be easily reproduced, by adding the following to tst_qdesktopservices::openUrl():

          const QUrl url("https://www.qt.io");
          QCOMPARE(QDesktopServices::openUrl(url), true);
      

      The website will not be launched. Instead, the following error message will appear (on openSuSE 15.6):

      kde-open: /home/axel/QtGit/toplevel/build/dev/qtbase/lib/libQt6Gui.so.6: version `Qt_6.8.1_PRIVATE_API' not found (required by /lib64/libKF6WindowSystem.so.6)
      

      The test will pass anyhow, because kde-open will write it to std::err, after QDesktopServices::openUrl() has returned true.

      Attachments

        For Gerrit Dashboard: QTBUG-132448
        # Subject Branch Project Status CR V

        Activity

          People

            qtbuildsystem Qt Build System Team
            axelspoerl Axel Spoerl
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change