Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xpra attach fails with "NameError: name 'xsync' is not defined" #347294

Open
jchv opened this issue Oct 8, 2024 · 4 comments
Open

xpra attach fails with "NameError: name 'xsync' is not defined" #347294

jchv opened this issue Oct 8, 2024 · 4 comments

Comments

@jchv
Copy link
Contributor

jchv commented Oct 8, 2024

(Note: if you're looking for a workaround, try setting GDK_BACKEND=x11.)

Describe the bug

Xpra crashes during attach.

$ nix run nixpkgs#xpra -- attach ...
2024-10-08 10:46:35,268 Xpra GTK3 X11 client version 6.1.2
2024-10-08 10:46:35,271  running on Linux 6.11.1
2024-10-08 10:46:35,271  cpython 3.12
2024-10-08 10:46:35,271  window manager is 'sway on wayland'
2024-10-08 10:46:35,828 GStreamer version 1.24.3
2024-10-08 10:46:35,844 Warning: failed to load the GObject notifier
2024-10-08 10:46:35,844  Namespace Notify not available
2024-10-08 10:46:35,848 created unix domain sockets:
2024-10-08 10:46:35,848  '/run/user/1000/xpra/clients/curly-299510'
2024-10-08 10:46:36,017 removing unix domain socket '/run/user/1000/xpra/clients/curly-299510'
xpra main error:
Traceback (most recent call last):
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/scripts/main.py", line 138, in main
    return run_mode(script_file, cmdline, err, options, args, mode, defaults)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/scripts/main.py", line 507, in run_mode
    return do_run_mode(script_file, cmdline, error_cb, options, args, full_mode, defaults)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/scripts/main.py", line 604, in do_run_mode
    return run_client(script_file, cmdline, error_cb, options, args, mode)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/scripts/main.py", line 1484, in run_client
    app = get_client_app(cmdline, error_cb, opts, extra_args, mode)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/scripts/main.py", line 1653, in get_client_app
    app = get_client_gui_app(error_cb, opts, request_mode, extra_args, mode)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/scripts/main.py", line 1725, in get_client_gui_app
    app.init_ui(opts)
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/client/gui/ui_client_base.py", line 224, in init_ui
    self.keyboard_helper = self.keyboard_helper_class(send_keyboard, opts.keyboard_sync,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/client/gtk3/keyboard_helper.py", line 31, in __init__
    self.update()
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/client/gtk3/keyboard_helper.py", line 84, in update
    super().update()
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/client/gui/keyboard_helper.py", line 300, in update
    self.query_xkbmap()
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/client/gui/keyboard_helper.py", line 278, in query_xkbmap
    self.layout, self.layouts, self.variant, self.variants, self.options = self.get_layout_spec()
                                                                           ^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/client/gui/keyboard_helper.py", line 231, in get_layout_spec
    layout, layouts, variant, variants, options = self.keyboard.get_layout_spec()
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k442kmivv1v9i051xka9a4dk7wfcpaip-xpra-6.1.2/lib/python3.12/site-packages/xpra/platform/posix/keyboard.py", line 274, in get_layout_spec
    with xsync:
         ^^^^^
NameError: name 'xsync' is not defined

Happens in either XWayland or Wayland.

Steps To Reproduce

Steps to reproduce the behavior:

  1. xpra attach ...

Expected behavior

Shouldn't crash.

Screenshots

Can't.

Additional context

No time to dig into this yet, sorry. I can at least begin a bisect since that is ~zero effort on my part.

Notify maintainers

@offlinehacker @numinit @mvnetbiz

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.11.1, NixOS, 24.11 (Vicuna), 24.11.20241004.bc947f5`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - channels(root): `"nixos"`
 - channels(john): `""`
 - nixpkgs: `/nix/store/sdzpqjwx7pdx6lsq6llyfqqf7hspp83c-source`

Add a 👍 reaction to issues you find important.

@jchv
Copy link
Contributor Author

jchv commented Oct 8, 2024

Bisect finished.

2004f7c00f346eca5917c3f1cacaeca347fa2498 is the first bad commit
commit 2004f7c00f346eca5917c3f1cacaeca347fa2498 (HEAD)
Author: Daniel Höxtermann <daniel@hxtm.dev>
Date:   Sun Aug 4 16:58:05 2024 +0200

    xpra: 5.0.9 -> 6.1.2

 pkgs/tools/X11/xpra/default.nix      | 11 ++++-------
 pkgs/tools/X11/xpra/fix-122159.patch | 22 ++++++++++++----------
 pkgs/tools/X11/xpra/fix-41106.patch  | 14 +++++++-------
 pkgs/tools/X11/xpra/fix-paths.patch  | 37 -------------------------------------
 4 files changed, 23 insertions(+), 61 deletions(-)
 delete mode 100644 pkgs/tools/X11/xpra/fix-paths.patch

So it looks like 2004f7c is implicated, merged in #332295.

@jchv
Copy link
Contributor Author

jchv commented Oct 8, 2024

Ahhh, I see. The problem is that Xpra 6.1.2 is broken on Wayland, but its detection for Wayland is broken too, so it sometimes will break even when it has already loaded in X11 mode. The trick is to set GDK_BACKEND=x11 instead of WAYLAND_DISPLAY=.

The commit that breaks Wayland is very confusing though. It looks like it would break indiscriminately. I assume this must've been tested since it was explicitly meant to improve something on Wayland, but I must admit I'm not sure how it could've ever worked. The uses of xsync are still there even when xsync isn't imported!

Xpra-org/xpra@a94c3c6#diff-f81e7014c874ec613e3c5f250a63da79f86f1b7d937086a58fafd82016c7335bR19

@jchv
Copy link
Contributor Author

jchv commented Oct 8, 2024

I don't really have more time to work on this right now so if someone happens to get to this before me I think the best course of action will just be to revert the commit that causes the problem, probably. Maybe could sneak it in with a 6.1.3 update. I'll try to grab it by the weekend if nobody else gets it.

@jchv
Copy link
Contributor Author

jchv commented Oct 9, 2024

Update: The issue was fixed upstream, so now all we need to do is either wait for a new release to update to, or just add the patch.

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

No branches or pull requests

1 participant