#10154·deskflow

Wayland portal clipboard intermittently fails after duplicate selection claims

Author: luomeng119Created Sep 17, 2026Updated Sep 17, 2026
Labels:apple: macwayland:large_orange_diamond: pending response

Before reporting a bug, please complete the sanity checks above

  • I searched open and closed issues/PRs for Wayland portal clipboard, duplicate SetSelection, and transfer serial errors; I did not find a matching report.
  • I reviewed the current master implementation (217166c06b2225adcecd1b78d815d23da0b991bd) and built it on Ubuntu 26.04. The duplicate clipboard-claim path is still present.

Deskflow version info

Server: Deskflow 1.26.0 on macOS
Client: deskflow-core v1.26.0, protocol v1.8
Client source used for reproduction: a0a368928c2c3ff93e85456aa6f4f9d90d0ef28e
Client OS/session: Ubuntu 26.04.1, GNOME Wayland
Portal stack: xdg-desktop-portal GNOME with libportal 0.10.0

The proposed fix has also been forward-ported and built against current master at 217166c06b2225adcecd1b78d815d23da0b991bd.

Build types

  • Official release on the macOS server
  • Local developer build on the Linux clients

Deskflow configuration

  • One macOS Deskflow server
  • Three Ubuntu GNOME Wayland clients
  • Clipboard sharing enabled
  • Clients use the libportal remote-desktop/clipboard backend

What steps will reproduce the problem?

  1. Start a macOS Deskflow server and an Ubuntu GNOME Wayland client using the libportal backend.
  2. Copy text on macOS.
  3. Move control to the Ubuntu client and paste.
  4. Repeat with new clipboard contents.

The paste is intermittent. When the same clipboard update reaches the client more than once, Deskflow publishes the same portal selection again while the previous transfer is still active. The replacement claim invalidates the in-flight transfer.

Log output

Representative portal-side sequence observed during a failed paste:

SetSelection(...)
SetSelection(...)  # same payload and portal session
Transfer serial N doesn't match any transfer request

Deskflow also recorded failures such as:

ERROR: failed to read clipboard selection: invalid fd

Additional information

A local fix tracks the last marshalled clipboard payload per portal session, skips only identical repeated claims, resets the tracker when the session closes, and publishes the cached clipboard after the asynchronous portal session becomes ready.

That behavior has been validated with unit tests and real copy/paste from one macOS server to three Ubuntu GNOME Wayland clients. The client continues to publish changed clipboard contents normally.