Closed Beyley closed 1 year ago
Well, does it output anything? Any error messages? Can you get me WAYLAND_DEBUG
logs?
Well, does it output anything? Any error messages? Can you get me
WAYLAND_DEBUG
logs?
I was able to redirect the standard error to a file, and with WAYLAND_DEBUG=1, i got this
[4099618.237] -> wl_display@1.get_registry(new id wl_registry@2)
[4099618.245] -> wl_display@1.sync(new id wl_callback@3)
[4099623.372] wl_display@1.delete_id(3)
[4099623.379] wl_registry@2.global(1, "wl_compositor", 5)
[4099623.381] -> wl_registry@2.bind(1, "wl_compositor", 2, new id [unknown]@4)
[4099623.385] wl_registry@2.global(2, "zwp_tablet_manager_v2", 1)
[4099623.386] wl_registry@2.global(3, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[4099623.387] wl_registry@2.global(5, "xdg_wm_base", 4)
[4099623.389] -> wl_registry@2.bind(5, "xdg_wm_base", 1, new id [unknown]@5)
[4099623.390] wl_registry@2.global(6, "zwlr_layer_shell_v1", 3)
[4099623.391] wl_registry@2.global(7, "zxdg_decoration_manager_v1", 1)
[4099623.392] wl_registry@2.global(8, "wp_viewporter", 1)
[4099623.393] wl_registry@2.global(9, "wl_shm", 1)
[4099623.395] -> wl_registry@2.bind(9, "wl_shm", 1, new id [unknown]@6)
[4099623.396] wl_registry@2.global(10, "wl_seat", 7)
[4099623.398] -> wl_registry@2.bind(10, "wl_seat", 2, new id [unknown]@7)
[4099623.399] wl_registry@2.global(11, "zwp_pointer_gestures_v1", 3)
[4099623.400] wl_registry@2.global(12, "zwp_pointer_constraints_v1", 1)
[4099623.401] wl_registry@2.global(13, "zwp_relative_pointer_manager_v1", 1)
[4099623.402] wl_registry@2.global(14, "wl_data_device_manager", 3)
[4099623.403] -> wl_registry@2.bind(14, "wl_data_device_manager", 1, new id [unknown]@8)
[4099623.404] wl_registry@2.global(15, "zwlr_data_control_manager_v1", 2)
[4099623.406] -> wl_registry@2.bind(15, "zwlr_data_control_manager_v1", 2, new id [unknown]@9)
[4099623.407] wl_registry@2.global(16, "zwp_primary_selection_device_manager_v1", 1)
[4099623.408] -> wl_registry@2.bind(16, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@10)
[4099623.409] wl_registry@2.global(17, "org_kde_kwin_idle", 1)
[4099623.410] wl_registry@2.global(18, "zwp_idle_inhibit_manager_v1", 1)
[4099623.411] wl_registry@2.global(19, "org_kde_plasma_shell", 8)
[4099623.412] wl_registry@2.global(20, "org_kde_kwin_appmenu_manager", 1)
[4099623.413] wl_registry@2.global(21, "org_kde_kwin_server_decoration_palette_manager", 1)
[4099623.414] wl_registry@2.global(23, "org_kde_plasma_virtual_desktop_management", 2)
[4099623.415] wl_registry@2.global(25, "org_kde_kwin_shadow_manager", 2)
[4099623.416] wl_registry@2.global(26, "org_kde_kwin_dpms_manager", 1)
[4099623.417] wl_registry@2.global(27, "org_kde_kwin_server_decoration_manager", 1)
[4099623.418] wl_registry@2.global(28, "kde_output_management_v2", 2)
[4099623.419] wl_registry@2.global(29, "kde_primary_output_v1", 2)
[4099623.420] wl_registry@2.global(30, "zxdg_output_manager_v1", 3)
[4099623.421] wl_registry@2.global(31, "wl_subcompositor", 1)
[4099623.422] wl_registry@2.global(32, "zxdg_exporter_v2", 1)
[4099623.423] wl_registry@2.global(33, "zxdg_importer_v2", 1)
[4099623.424] wl_registry@2.global(35, "xdg_activation_v1", 1)
[4099623.425] wl_registry@2.global(37, "wp_drm_lease_device_v1", 1)
[4099623.426] wl_registry@2.global(40, "wl_drm", 2)
[4099623.427] wl_registry@2.global(41, "zwp_linux_dmabuf_v1", 4)
[4099623.428] wl_registry@2.global(43, "kde_output_device_v2", 2)
[4099623.429] wl_registry@2.global(44, "kde_output_device_v2", 2)
[4099623.430] wl_registry@2.global(45, "wl_output", 4)
[4099623.431] wl_registry@2.global(46, "wl_output", 4)
[4099623.432] wl_registry@2.global(47, "zwp_text_input_manager_v2", 1)
[4099623.433] wl_registry@2.global(48, "zwp_text_input_manager_v3", 1)
[4099623.434] wl_registry@2.global(50, "org_kde_kwin_contrast_manager", 2)
[4099623.435] wl_registry@2.global(51, "org_kde_kwin_blur_manager", 1)
[4099623.436] wl_registry@2.global(52, "org_kde_kwin_slide_manager", 1)
[4099623.437] wl_callback@3.done(2036)
[4099623.439] -> wl_display@1.sync(new id wl_callback@3)
[4099623.493] wl_display@1.delete_id(3)
[4099623.494] wl_seat@7.capabilities(7)
[4099623.495] wl_seat@7.name("")
[4099623.496] wl_callback@3.done(2036)
[4099623.498] -> zwlr_data_control_manager_v1@9.get_data_device(new id zwlr_data_control_device_v1@3, wl_seat@7)
[4099623.500] -> wl_display@1.sync(new id wl_callback@11)
[4099623.631] wl_display@1.delete_id(11)
[4099623.632] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190080)
[4099623.633] zwlr_data_control_offer_v1@4278190080.offer("text/html")
[4099623.634] zwlr_data_control_offer_v1@4278190080.offer("text/_moz_htmlcontext")
[4099623.635] zwlr_data_control_offer_v1@4278190080.offer("text/_moz_htmlinfo")
[4099623.636] zwlr_data_control_offer_v1@4278190080.offer("text/plain;charset=utf-8")
[4099623.637] zwlr_data_control_offer_v1@4278190080.offer("UTF8_STRING")
[4099623.638] zwlr_data_control_offer_v1@4278190080.offer("COMPOUND_TEXT")
[4099623.639] zwlr_data_control_offer_v1@4278190080.offer("TEXT")
[4099623.640] zwlr_data_control_offer_v1@4278190080.offer("text/plain")
[4099623.641] zwlr_data_control_offer_v1@4278190080.offer("STRING")
[4099623.641] zwlr_data_control_offer_v1@4278190080.offer("text/plain;charset=utf-8")
[4099623.642] zwlr_data_control_offer_v1@4278190080.offer("text/plain")
[4099623.643] zwlr_data_control_offer_v1@4278190080.offer("text/x-moz-url-priv")
[4099623.644] zwlr_data_control_offer_v1@4278190080.offer("SAVE_TARGETS")
[4099623.645] zwlr_data_control_device_v1@3.selection(zwlr_data_control_offer_v1@4278190080)
[4099623.646] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190081)
[4099623.647] zwlr_data_control_offer_v1@4278190081.offer("text/html")
[4099623.648] zwlr_data_control_offer_v1@4278190081.offer("text/_moz_htmlcontext")
[4099623.649] zwlr_data_control_offer_v1@4278190081.offer("text/_moz_htmlinfo")
[4099623.650] zwlr_data_control_offer_v1@4278190081.offer("text/plain;charset=utf-8")
[4099623.651] zwlr_data_control_offer_v1@4278190081.offer("UTF8_STRING")
[4099623.652] zwlr_data_control_offer_v1@4278190081.offer("COMPOUND_TEXT")
[4099623.653] zwlr_data_control_offer_v1@4278190081.offer("TEXT")
[4099623.653] zwlr_data_control_offer_v1@4278190081.offer("text/plain")
[4099623.654] zwlr_data_control_offer_v1@4278190081.offer("STRING")
[4099623.655] zwlr_data_control_offer_v1@4278190081.offer("text/plain;charset=utf-8")
[4099623.656] zwlr_data_control_offer_v1@4278190081.offer("text/plain")
[4099623.657] zwlr_data_control_offer_v1@4278190081.offer("text/x-moz-url-priv")
[4099623.658] zwlr_data_control_device_v1@3.primary_selection(zwlr_data_control_offer_v1@4278190081)
[4099623.659] wl_callback@11.done(2036)
[4099623.660] -> zwlr_data_control_manager_v1@9.create_data_source(new id zwlr_data_control_source_v1@11)
[4099623.661] -> zwlr_data_control_source_v1@11.offer("text/plain")
[4099623.663] -> zwlr_data_control_source_v1@11.offer("text/plain;charset=utf-8")
[4099623.664] -> zwlr_data_control_source_v1@11.offer("TEXT")
[4099623.665] -> zwlr_data_control_source_v1@11.offer("STRING")
[4099623.665] -> zwlr_data_control_source_v1@11.offer("UTF8_STRING")
[4099623.666] -> zwlr_data_control_device_v1@3.set_primary_selection(zwlr_data_control_source_v1@11)
[4099623.668] -> wl_display@1.sync(new id wl_callback@12)
[4099623.723] wl_display@1.delete_id(12)
[4099623.725] zwlr_data_control_device_v1@3.data_offer(new id zwlr_data_control_offer_v1@4278190082)
[4099623.727] zwlr_data_control_offer_v1@4278190082.offer("text/plain")
[4099623.728] zwlr_data_control_offer_v1@4278190082.offer("text/plain;charset=utf-8")
[4099623.729] zwlr_data_control_offer_v1@4278190082.offer("TEXT")
[4099623.730] zwlr_data_control_offer_v1@4278190082.offer("STRING")
[4099623.732] zwlr_data_control_offer_v1@4278190082.offer("UTF8_STRING")
[4099623.733] zwlr_data_control_device_v1@3.primary_selection(zwlr_data_control_offer_v1@4278190082)
[4099623.735] wl_callback@12.done(2036)
[4152321.209] zwlr_data_control_source_v1@11.cancelled()
[4152321.209] zwlr_data_control_source_v1@11.cancelled()
See, the data source is getting cancelled immediately, without anyone even requesting the data from the source — but not before the compositor accepts the source (and publishes it back as a data offer). So this is not the case of the compositor rejecting the data source (or the set_primary_selection()
method call) for some reason.
Does this still happen if you disable your clipboard manager (Klipper)?
Disabling klipper (i think i was able to? its not clear how to do so, but i set it to disabled) did not seem to help, it still isnt working
I encountered the same issue when running a script using a shortcut.
Whilst playing around, trying to get Debug-output, i got it working..
When piping stdout to anything (i tested /dev/null
and files), it works..
Here the stderr-outputs of both versions with debug enabled:
WAYLAND_DEBUG=1 wl-copy "foobar" 2>/tmp/error`
WAYLAND_DEBUG=1 wl-copy "foobar" >/dev/null 2>/tmp/error`
For obvious reasons i cannot compare the stdout. Maybe thats where the problem is. Not sure how the shortcut launches the script, but if it didnt have an stdout (if thats even possible) that could lead to problems? This would also explain why it works when running the script normally as it then has an stdout.
Hope it helps.
That is helpful, thank you!
What version of wl-clipboard do you have, does it include https://github.com/bugaevc/wl-clipboard/commit/aa4633b894c3c5ae6053026529ec9288566060a6 (which is in 2.1.0 and newer)?
wl_display_dispatch: Socket operation on non-socket
This is certainly concerning.
What could happen here is that wl-copy
is launched without an stdout, so the Wayland connection gets fd 1, which wl-copy
then closes thinking that it's its stdout. That itself will break everything, but then some other file is opened under the same fd 1, and wl_display_dispatch
tries to operate on that and finds out that it's not a socket.
Would it be possible for you to find out whether wl-copy
indeed starts up with some of the standard fds (0, 1, 2) closed?
What version of wl-clipboard do you have, does it include aa4633b (which is in 2.1.0 and newer)?
--version
reports 2.1.0
I'll try to check how its launched and what state the pipes have.
# Check if stdin exists
if [ -t 0 ]; then
echo "stdin exists" >> /tmp/output
else
echo "stdin does not exist" >> /tmp/output
fi
# Check if stdout exists
if [ -t 1 ]; then
echo "stdout exists" >> /tmp/output
else
echo "stdout does not exist" >> /tmp/output
fi
# Check if stderr exists
if [ -t 2 ]; then
echo "stderr exists" >> /tmp/output
else
echo "stderr does not exist" >> /tmp/output
fi
Ran once with a shortcut and once directly:
stdin does not exist
stdout does not exist
stderr does not exist
stdin exists
stdout exists
stderr exists
Thank you!
In this case it clearly is an issue with how KDE spawns processes from shortcuts. It absolutely should provide the standard descriptors. It would be best to connect stdout and stderr to the system journal in this case, like it's done for services, but if that's not available, it should at least open /dev/null
. All the Unix software is written under the assumption that it can use stdout/stderr and that won't interfere with whatever other files it opens. This is not something that the launched software can be reasonably expected to check, it's on KDE (or whoever spawns wl-clipboard) to provide it with a sane environment.
So please report this to KDE, it's their bug.
However, seeing how multiple people have reported it against wl-clipboard, I'll add a check that the Wayland fd is > 2. If it isn't, wl-clipboard will try to log a message (which is tricky when you might not have stderr...) explaining what's going on and abort.
Thank you again for figuring this out!
Bug is filed: https://bugs.kde.org/show_bug.cgi?id=469328
Everyone (@Beyley, @Ruakij, @QazCetelic, @OhaDerErste), please try the abort-on-closed-stdio
branch. If this is indeed what's happening, wl-clipboard will now complain loudly -- to the journal if there's no other option.
So please all state whether or not this is happening in your case.
I have compiled and tested the branch. I get the error-message in stderr you set and wl-copy exits with code 134.
When stderr is not attached, this prints in the journal:
Awesome -- so if you didn't already know what's going on, would that be enough to point you in the right direction?
I think the visibility might be a problem, but you dont really have other choices :) But yeah i think the log message should be sufficient to know or at least search what the issue might be (and probably finding this issue :+1:)
If i attempt to copy to the clipboard from an app launched from a terminal, it works fine, but if i do it from an app launched from a KDE keyboard shortcut, then nothing seems to happen, googling has not provided much help here
its a very simple C# script im using https://gist.github.com/Beyley/b807d522019e2e681204c2ffeb5be616