Skip to content

qt6packages.qtwayland: Update wayland.xml to version 1.23.0#337913

Merged
K900 merged 1 commit intoNixOS:masterfrom
wineee:qt6-wayland
Aug 29, 2024
Merged

qt6packages.qtwayland: Update wayland.xml to version 1.23.0#337913
K900 merged 1 commit intoNixOS:masterfrom
wineee:qt6-wayland

Conversation

@wineee
Copy link
Member

@wineee wineee commented Aug 28, 2024

Description of changes

It's usefull since #316130

Qt wayland compositor is broken due to wayland-protocols (especially wl_shm) upgrade,compositor that using qtwayland may cause client crash due to protocol version mismatch

Build and run a simple compositor example:
https://doc.qt.io/qt-6/qtwaylandcompositor-examples.html

Run a client,the client will crash

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@wineee wineee marked this pull request as ready for review August 28, 2024 10:20
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels Aug 28, 2024
@wineee wineee changed the title qtwayland: Update wayland.xml to version 1.23.0 qt6packages.qtwayland: Update wayland.xml to version 1.23.0 Aug 28, 2024
@SuperSandro2000
Copy link
Member

Sounds reasonable to me

@K900
Copy link
Contributor

K900 commented Aug 28, 2024

Uhh, what. Wayland negotiates protocol versions, the compositor not supporting newer versions should not be an issue.

@wineee
Copy link
Member Author

wineee commented Aug 28, 2024

In fact, the clients using qtwayland were not affected, only the wayland compositor written by qtwayland had a serious bug
At present, nixpkgs probably don`t have any compositor using qtwayland,But the official example of qtwayland can reproduce this bug

I can reproduce this issue in NixOS and openSUSE, but Arch Linux works fine. I found it`s this patch fixed it.

Update: Arch Linux seems to have introduced this patch to fix a bug in Telegram Desktop :

The incompatibility of wl_shm versions makes Telegram Desktop fail to open Mini Apps.

@K900
Copy link
Contributor

K900 commented Aug 28, 2024

This feels very wrong. I'm willing to merge this because I don't really see major risks, but I would like to also understand how this is causing an issue, because it absolutely should not be.

@NickCao
Copy link
Member

NickCao commented Aug 28, 2024

In fact, the clients using qtwayland were not affected, only the wayland compositor written by qtwayland had a serious bug
At present, nixpkgs probably don`t have any compositor using qtwayland,But the official example of qtwayland can reproduce this bug

But isn't the example a client?

@K900
Copy link
Contributor

K900 commented Aug 28, 2024

OK so I think the issue here actually is: if the compositor is built with the vendored 1.22 header, and the client is built with 1.23, the client attempts to speak a new version of the protocol to the server, and then dies because the server doesn't understand it.

@wineee
Copy link
Member Author

wineee commented Aug 29, 2024

But isn't the example a client?

The QtWayland module consists of two parts:

Wayland platform plugin:
    Enables Qt applications to be run as Wayland clients.

QtWaylandCompositor API:
    Enables the creation of Wayland compositors using Qt and QtQuick.

qtwayland's example is a wayland compositor using QtWaylandCompositor API.
Similar to wlroots, it support drm/wayland/x11 backends, you can run it as a client, just like you can run sway under sway,the former is drm backend, while the latter is wayland backend

For clients side, all GUI clients can reproduce this bug, even if it's a qt/qml client, it seems that the qtwayland's platform plugin does not use the vendored protocol

@wineee
Copy link
Member Author

wineee commented Aug 29, 2024

@Sodivad
Copy link

Sodivad commented Aug 29, 2024

It looks like the following upstream issue:
The problem is QtWaylandCompositor uses wayland-scanner with the public-code option. This causes wl_interface definitions to be exported. libwayland also exports a set of protocol definitions of the core protocol.
In this case qtwaylandcompositor has wl_shm_interface corresponding to version 1, libwayland has wl_shm_interface corresponding to version 2. The dynamic linker resolves the symbol to the one from qtwaylandcompositor. Now wl_display_init_shm will call wl_global_create with version 2. This fails because the version is higher than the interface version. In effect no wl_shm global will be present.
This is something most clients cannot cope with.

@K900 K900 merged commit 85be051 into NixOS:master Aug 29, 2024
@K900
Copy link
Contributor

K900 commented Aug 29, 2024

OK, this makes more sense now.

@wineee wineee deleted the qt6-wayland branch August 29, 2024 08:04
@wineee
Copy link
Member Author

wineee commented Oct 22, 2024

There seems to be a better solution to the problem:

https://codereview.qt-project.org/c/qt/qtwayland/+/598596

client: Run waylandscanner with private-code

This is the recommended mode, and failing to use private-code
makes libraries expose generated symbols like wl_shm_interface,
which may conflict with symbols from libwayland leading to
unexpected behavior or aborts.

@K900
Copy link
Contributor

K900 commented Oct 22, 2024

Yes, this was always the intended long term solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants