atx / wtype

xdotool type for wayland
MIT License
373 stars 13 forks source link

wl_display@1: error 2: no memory #16

Closed jbeich closed 3 years ago

jbeich commented 3 years ago

Environment

$ cc --version
FreeBSD clang version 11.0.0 (git@github.com:llvm/llvm-project.git llvmorg-11.0.0-0-g176249bd673)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

$ sway --version
sway version 1.5-80-g9d6787d1
wlroots version 0.12.0-11-g2eae9ec7

Steps to reproduce

$ pkg install meson pkgconf wayland libxkbcommon
$ meson setup _build && meson compile -C _build
$ WAYLAND_DEBUG=1 _build/wtype blah
[  1488.953]  -> wl_display@1.get_registry(new id wl_registry@2)
[  1489.279] wl_registry@2.global(1, "wl_shm", 1)
[  1489.330] wl_registry@2.global(2, "wl_drm", 2)
[  1489.356] wl_registry@2.global(3, "zwp_linux_dmabuf_v1", 3)
[  1489.374] wl_registry@2.global(4, "wl_compositor", 4)
[  1489.390] wl_registry@2.global(5, "wl_subcompositor", 1)
[  1489.407] wl_registry@2.global(6, "wl_data_device_manager", 3)
[  1489.425] wl_registry@2.global(7, "zwlr_gamma_control_manager_v1", 1)
[  1489.442] wl_registry@2.global(8, "gtk_primary_selection_device_manager", 1)
[  1489.458] wl_registry@2.global(9, "zxdg_output_manager_v1", 3)
[  1489.474] wl_registry@2.global(10, "org_kde_kwin_idle", 1)
[  1489.491] wl_registry@2.global(11, "zwp_idle_inhibit_manager_v1", 1)
[  1489.511] wl_registry@2.global(12, "zwlr_layer_shell_v1", 2)
[  1489.528] wl_registry@2.global(13, "xdg_wm_base", 2)
[  1489.544] wl_registry@2.global(14, "zwp_tablet_manager_v2", 1)
[  1489.560] wl_registry@2.global(15, "org_kde_kwin_server_decoration_manager", 1)
[  1489.576] wl_registry@2.global(16, "zxdg_decoration_manager_v1", 1)
[  1489.593] wl_registry@2.global(17, "zwp_relative_pointer_manager_v1", 1)
[  1489.609] wl_registry@2.global(18, "zwp_pointer_constraints_v1", 1)
[  1489.625] wl_registry@2.global(19, "wp_presentation", 1)
[  1489.643] wl_registry@2.global(20, "zwlr_output_manager_v1", 2)
[  1489.659] wl_registry@2.global(21, "zwlr_output_power_manager_v1", 1)
[  1489.675] wl_registry@2.global(22, "zwp_input_method_manager_v2", 1)
[  1489.695] wl_registry@2.global(23, "zwp_text_input_manager_v3", 1)
[  1489.713] wl_registry@2.global(24, "zwlr_foreign_toplevel_manager_v1", 3)
[  1489.729] wl_registry@2.global(25, "zwlr_export_dmabuf_manager_v1", 1)
[  1489.744] wl_registry@2.global(26, "zwlr_screencopy_manager_v1", 3)
[  1489.760] wl_registry@2.global(27, "zwlr_data_control_manager_v1", 2)
[  1489.776] wl_registry@2.global(28, "zwp_primary_selection_device_manager_v1", 1)
[  1489.793] wl_registry@2.global(29, "wp_viewporter", 1)
[  1489.810] wl_registry@2.global(30, "zwp_virtual_keyboard_manager_v1", 1)
[  1489.833]  -> wl_registry@2.bind(30, "zwp_virtual_keyboard_manager_v1", 1, new id [unknown]@3)
[  1489.863] wl_registry@2.global(31, "zwlr_virtual_pointer_manager_v1", 2)
[  1489.884] wl_registry@2.global(32, "zwlr_input_inhibit_manager_v1", 1)
[  1489.900] wl_registry@2.global(33, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[  1489.916] wl_registry@2.global(34, "wl_seat", 7)
[  1489.935]  -> wl_registry@2.bind(34, "wl_seat", 7, new id [unknown]@4)
[  1489.960] wl_registry@2.global(35, "zwp_pointer_gestures_v1", 1)
[  1489.978] wl_registry@2.global(42, "wl_output", 3)
[  1490.004]  -> wl_display@1.sync(new id wl_callback@5)
[  1490.165] wl_display@1.delete_id(5)
[  1490.187] wl_callback@5.done(158426)
[  1490.209]  -> zwp_virtual_keyboard_manager_v1@3.create_virtual_keyboard(wl_seat@4, new id zwp_virtual_keyboard_v1@5)
[  1490.414]  -> zwp_virtual_keyboard_v1@5.keymap(1, fd 5, 0)
[  1490.448]  -> wl_display@1.sync(new id wl_callback@6)
[  1498.183] wl_display@1.error(wl_display@1, 2, "no memory")
wl_display@1: error 2: no memory

Similar application

$ pkg install wlrctl
$ wlrctl keyboard type blah
$ blah
atx commented 3 years ago

Ah, looks like FreeBSD shm objects do not get extended by writes:

Writes do not extend shared memory objects, so ftruncate(2) must be
called before any data can be written. 

I switched to an actual temporary file in bc262ff93e559c2f0b6da70557d3bec63173d520, see if that helps.

jbeich commented 3 years ago

Thanks. Works fine now, so I've packaged for FreeBSD. Packaging status