Xpra: Ticket #1285: UnboundLocalError: local variable 'utf8_title' referenced before assignment

2016-08-19 13:46:15,651 failed to set window metadata to '{'size-constraints': {'minimum-size': (300, 119), 'maximum-size': (32767, 32767), 'gravity': 1, 'base-size': (300, 119)}, 'iconic': False, 'modal': False, 'client-machine': 'l29ah-x201', 'pid': 2, 'group-leader-xid': 10485761, 'sticky': False, 'shape': {}, 'skip-taskbar': False, 'strut': {}, 'bypass-compositor': 0, 'fullscreen': False, 'xid': '0xa0001e', 'title': 'Mozilla Firefox', 'icon-title': 'Mozilla Firefox', 'window-type': ('NORMAL',), 'below': False, 'role': 'browser', 'above': False, 'maximized': True, 'command': '', 'class-instance': ('Navigator', 'Firefox'), 'shaded': False, 'skip-pager': False}'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/client/client_window_base.py", line 166, in update_metadata
    self.set_metadata(metadata)
  File "/usr/lib64/python2.7/site-packages/xpra/client/client_window_base.py", line 207, in set_metadata
    self.set_title(utf8_title)
UnboundLocalError: local variable 'utf8_title' referenced before assignment

And the window title shows "Xpra".



Fri, 19 Aug 2016 15:11:14 GMT - Antoine Martin: owner changed

I believe this is fixed in r13400, can you confirm?

You must have been using a --title= without an '@' sign in it, right?


Fri, 19 Aug 2016 15:48:22 GMT - L29Ah:

xpra main error:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 124, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 1102, in run_mode
    systemd_run = is_systemd_pid1()
  File "/usr/lib64/python2.7/site-packages/xpra/os_util.py", line 340, in is_systemd_pid1
    return d.find("/systemd")>=0
AttributeError: 'NoneType' object has no attribute 'find'

Yes.


Fri, 19 Aug 2016 16:21:27 GMT - Antoine Martin:

Ah, looks like your system doesn't have a /proc/1/cmdline proc file? r13401 should fix that, though we may not detect systemd properly in that case..


Fri, 19 Aug 2016 16:36:05 GMT - L29Ah:

Yes, grsecurity is set to forbid users to see others' processes.

[Errno 2] No such file or directory: '/var/tmp/paludis/x11-wm-xpra-9999/temp//run/xpra'
xpra main error:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 124, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 1135, in run_mode
    return run_server(error_cb, options, mode, script_file, args, current_display)
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/server.py", line 1006, in run_server
    logfd = open_log_file(log_filename0)
  File "/usr/lib64/python2.7/site-packages/xpra/scripts/server.py", line 553, in open_log_file
    return os.open(logpath, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o666)
OSError: [Errno 2] No such file or directory: '/var/tmp/paludis/x11-wm-xpra-9999/temp//run/xpra/:253.log'

What's the proper way to tell the setup script that i'm going to install it into a temporary dir that will end up in /?


Sat, 20 Aug 2016 03:32:28 GMT - Antoine Martin:

What's the proper way to tell the setup script that i'm going to install it into a temporary dir that will end up in /?


There's code in setup.py to detect temporary build dirs with various hacks to strip those when needed. Please attach the build output to this ticket. (see build_xpra_conf) Mine looks like this:

convert_templates([]) dirname=etc/xpra, target_dir=/etc/xpra
convert_templates(['conf.d']) dirname=etc/xpra/conf.d, target_dir=/etc/xpra/conf.d

Sun, 21 Aug 2016 01:54:47 GMT - L29Ah:

I've done this:

--- /tmp/setup.py	2016-08-21 03:58:35.778884774 +0300
+++ /tmp/setup.py	2016-08-21 04:41:15.148111045 +0300
@@ -780,6 +780,14 @@
             #strip rpm style build root:
             #[$HOME, "rpmbuild", "BUILDROOT", "xpra-$VERSION"] -> []
             dirs = dirs[dirs.index("BUILDROOT")+2:]
+        elif "temp" in dirs:
+            # Gentoo's "${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/temp" -> ""
+            while "temp" in dirs:
+                dirs = dirs[dirs.index("temp")+1:]
+        elif "work" in dirs:
+            # Gentoo's "${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/_python2.7" -> ""
+            while "image" in dirs:
+                dirs = dirs[dirs.index("image")+2:]
         elif "usr" in dirs:
             #ie: ["some", "path", "to", "usr"] -> ["usr"]
             #assume "/usr" or "/usr/local" is the build root

Yet i still see stuff like this in the config files:

#        -logfile /var/tmp/paludis/x11-wm-xpra-9999/temp//run/xpra/Xorg.${DISPLAY}.log \

The relevant portion of the build log:


Sun, 21 Aug 2016 03:46:44 GMT - Antoine Martin: attachment set

using attachment for build log


Sun, 21 Aug 2016 04:14:28 GMT - Antoine Martin:

@L29Ah: r13410 works for me:

$ ./setup.py install --root=/var/tmp/paludis/x11-wm-xpra-9999/image/_python2.7
(..)
$ grep -r 9999 /var/tmp/paludis/x11-wm-xpra-9999/image/_python2.7/etc/xpra/ | wc -l
0

Mon, 22 Aug 2016 11:04:57 GMT - L29Ah:

comment:4


Mon, 22 Aug 2016 11:43:46 GMT - L29Ah:

And if i manually correct the config files, i get this:

‰ xpra attach :478
2016-08-22 14:40:10,368 Warning: all the compressors are disabled,
2016-08-22 14:40:10,368  unless you have a gigabit connection or better, performance will suffer
2016-08-22 14:40:10,369 Xpra gtk2 client version 1.0-runknown 64-bit
2016-08-22 14:40:10,369  running on Linux Gentoo 2.2 n/a
2016-08-22 14:40:10,371 Warning: failed to import opencv:
2016-08-22 14:40:10,371  No module named cv2
2016-08-22 14:40:10,371  webcam forwarding is disabled
2016-08-22 14:40:12,107 OpenGL_accelerate module loaded
2016-08-22 14:40:12,113 OpenGL enabled with Mesa DRI Intel(R) Ironlake Mobile
2016-08-22 14:40:12,373 keyboard layouts: us,ru,us,ru
2016-08-22 14:40:12,457 Error setting up dbus signals:
2016-08-22 14:40:12,457  org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
2016-08-22 14:40:12,474  keyboard settings: rules=evdev, model=pc105, layout=us,ru
2016-08-22 14:40:12,502  desktop size is 1280x800 with 1 screen:
2016-08-22 14:40:12,503   :1.0 (260x162 mm - DPI: 125x125)
2016-08-22 14:40:12,503     monitor 1 (261x163 mm - DPI: 124x124)
2016-08-22 14:40:12,632 Warning: cannot query ICC profiles:
2016-08-22 14:40:12,632  cannot import name _imagingcms
2016-08-22 14:40:12,710 server failure: disconnected before the session could be established
2016-08-22 14:40:12,711 server requested disconnect: server error (error accepting new connection)
2016-08-22 14:40:12,721 Connection lost

Mon, 22 Aug 2016 11:57:23 GMT - Antoine Martin:

What does comment:8 mean? Did comment:7 work for you or not?

2016-08-22 14:40:12,711 server requested disconnect: server error (error accepting new connection) - this error will be in your server log.


Mon, 22 Aug 2016 11:59:52 GMT - L29Ah:

It means that the problem is not relevant to /image/ dir but to the /temp/ one. No.

Nope, nothing shows up in the log when i try to connect.


Mon, 22 Aug 2016 12:34:19 GMT - Antoine Martin:

It means that the problem is not relevant to /image/ dir but to the /temp/ one.


Then you're using a build command line that you haven't shared with us yet. The one in your build log is fixed as per comment:7.


Nope, nothing shows up in the log when i try to connect.


That's not possible. There are only two "error accepting new connection" strings in the whole source tree and both are preceded by a logging statement which will log a full stacktrace to the server log file. (or stderr when running with "--no-daemon")


Mon, 22 Aug 2016 12:40:28 GMT - L29Ah:

Okay, i've missed this somehow when i tried running it with firejail:

2016-08-22 15:39:08,588 New unix-domain connection received on /home/l29ah/.xpra/l29ah-x201-666
2016-08-22 15:39:08,848 New unix-domain connection received on /home/l29ah/.xpra/l29ah-x201-666
2016-08-22 15:39:08,862 Handshake complete; enabling connection
2016-08-22 15:39:08,887 server error processing new connection from Protocol(unix-domain socket:/home/l29ah/.xpra/l29ah-x201-666): 'cython_function_or_method' object has no attribute 'warn'
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/xpra/server/server_core.py", line 881, in _process_hello
    self.hello_oked(proto, packet, c, auth_caps)
  File "/usr/lib64/python2.7/site-packages/xpra/server/server_base.py", line 1088, in hello_oked
    ServerSourceClass = self.get_server_source_class()
  File "/usr/lib64/python2.7/site-packages/xpra/x11/x11_server_base.py", line 194, in get_server_source_class
    from xpra.x11.x11_source import X11ServerSource
  File "/usr/lib64/python2.7/site-packages/xpra/x11/x11_source.py", line 7, in <module>
    from xpra.server.source import ServerSource
  File "/usr/lib64/python2.7/site-packages/xpra/server/source.py", line 34, in <module>
    from xpra.server.window.window_video_source import WindowVideoSource
  File "/usr/lib64/python2.7/site-packages/xpra/server/window/window_video_source.py", line 16, in <module>
    from xpra.server.window.motion import match_distance, consecutive_lines, calculate_distances, CRC_Image #@UnresolvedImport
  File "xpra/server/window/motion.pyx", line 17, in init xpra.server.window.motion (xpra/server/window/motion.c:3715)
AttributeError: 'cython_function_or_method' object has no attribute 'warn'
2016-08-22 15:39:08,894 Disconnecting client /home/l29ah/.xpra/l29ah-x201-666:
2016-08-22 15:39:08,894  server error (error accepting new connection)

Mon, 22 Aug 2016 12:43:41 GMT - Antoine Martin:

Gotcha. Fixed in r13430. For more information on the xxhash warning this is for, see ticket:1232#comment:9.


Mon, 22 Aug 2016 13:03:29 GMT - Antoine Martin:

Sorry, r13430 was bad, r13431 tested OK.


Mon, 22 Aug 2016 19:40:35 GMT - L29Ah:

Okay, worky, except i still see

socket-dirs = /var/tmp/paludis/x11-wm-xpra-9999/temp//run/xpra

in the config files. The full paludis' installation log:


Tue, 23 Aug 2016 02:19:01 GMT - Antoine Martin: attachment set

replacing pastebin with attachment, please don't use services that will eventually lead to a 404


Tue, 23 Aug 2016 03:06:26 GMT - Antoine Martin:


Here are the only two build command lines used, which I have extracted from the build log (please don't use pastes that will eventually timeout and make the ticket less useful in the future):

If I run those from the source tree, I get the same result as per comment:7.

./setup.py build
(..)
./setup.py install --root=/var/tmp/paludis/x11-wm-xpra-9999/image/_python2.7
(..)
$ grep -hr "socket-dirs =" /var/tmp/paludis/x11-wm-xpra-9999
#socket-dirs = /tmp
#socket-dirs = ~/.xpra
#socket-dirs = /var/run/xpra
socket-dirs = /run/user/$UID/xpra
socket-dirs = ~/.xpra

Looks fine to me.


Tue, 23 Aug 2016 11:01:34 GMT - L29Ah:

replacing pastebin with attachment, please don't use services that will eventually lead to a 404


https://dump.bitcheese.net stores files forever.

Why do we want to compile things when the --no-compile switch is used? And if that's really what is needed, why isn't this upstream?


I don't know, i've blindly copied it from the release ebuild found in the official gentoo's repos. It may be related to the idea of configuring and building stuff in different phases; dunno rly, i don't know Python build infra and Gentoo's kludges around it.

xpra-strip-build-dirs.patch - I don't know what that is or what it does, couldn't find it anywhere with a quick google.


This is the patch i've posted in comment:6


Wed, 07 Sep 2016 10:14:29 GMT - Antoine Martin: status changed; resolution set

I believe this is fixed, feel free to re-open if not.


Sat, 23 Jan 2021 05:20:06 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1285