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

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

Closed
totaam opened this issue Aug 19, 2016 · 24 comments
Closed

Comments

@totaam
Copy link
Collaborator

totaam commented Aug 19, 2016

Issue migrated from trac ticket # 1285

component: client | priority: minor | resolution: fixed

2016-08-19 12:20:40: L29Ah created the issue


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".

@totaam
Copy link
Collaborator Author

totaam commented Aug 19, 2016

2016-08-19 16:11:14: antoine changed owner from antoine to L29Ah

@totaam
Copy link
Collaborator Author

totaam commented Aug 19, 2016

2016-08-19 16:11:14: antoine commented


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

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

@totaam
Copy link
Collaborator Author

totaam commented Aug 19, 2016

2016-08-19 16:48:22: L29Ah commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Aug 19, 2016

2016-08-19 17:21:28: antoine commented


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..

@totaam
Copy link
Collaborator Author

totaam commented Aug 19, 2016

2016-08-19 17:36:05: L29Ah commented


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 /?

@totaam
Copy link
Collaborator Author

totaam commented Aug 20, 2016

2016-08-20 04:32:29: antoine commented


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 /?
[[BR]]
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

@totaam
Copy link
Collaborator Author

totaam commented Aug 21, 2016

2016-08-21 02:54:48: L29Ah commented


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:

@totaam
Copy link
Collaborator Author

totaam commented Aug 21, 2016

2016-08-21 04:46:45: antoine uploaded file 1285-build-log.txt (185.4 KiB)

using attachment for build log

@totaam
Copy link
Collaborator Author

totaam commented Aug 21, 2016

2016-08-21 05:14:28: antoine commented


@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

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 12:04:58: L29Ah commented


comment:4

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 12:43:47: L29Ah commented


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

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 12:57:23: antoine commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 12:59:52: L29Ah commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 13:34:20: antoine commented


It means that the problem is not relevant to /image/ dir but to the /temp/ one.
[[BR]]
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.
[[BR]]
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")

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 13:40:29: L29Ah commented


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)

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 13:43:42: antoine commented


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

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 14:03:30: antoine commented


Sorry, r13430 was bad, r13431 tested OK.

@totaam
Copy link
Collaborator Author

totaam commented Aug 22, 2016

2016-08-22 20:40:36: L29Ah commented


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:

@totaam
Copy link
Collaborator Author

totaam commented Aug 23, 2016

2016-08-23 03:19:01: antoine uploaded file paludis-build.log (331.6 KiB)

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

@totaam
Copy link
Collaborator Author

totaam commented Aug 23, 2016

2016-08-23 04:06:27: antoine commented


  • xpra-0.13.1-ignore-gentoo-no-compile.patch (I found a copy somewhere) undoes a change that was made specifically for gentoo. 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?
  • 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.

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):

  • setup.py (...) build
  • setup.py (...) install --root=/var/tmp/paludis/x11-wm-xpra-9999/image/_python2.7

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.

@totaam
Copy link
Collaborator Author

totaam commented Aug 23, 2016

2016-08-23 12:01:35: L29Ah commented


replacing pastebin with attachment, please don't use services that will eventually lead to a 404
[[BR]]
https://dump.bitcheese.net stores files forever.
[[BR]]

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?
[[BR]]
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.
[[BR]]
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.
[[BR]]
This is the patch i've posted in comment:6

@totaam
Copy link
Collaborator Author

totaam commented Sep 7, 2016

2016-09-07 11:14:29: antoine changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Sep 7, 2016

2016-09-07 11:14:29: antoine set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Sep 7, 2016

2016-09-07 11:14:29: antoine commented


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

@totaam totaam closed this as completed Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant