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

Deadkeys on Linux panics #366

Closed
TimDiekmann opened this issue Dec 16, 2017 · 9 comments · Fixed by #432
Closed

Deadkeys on Linux panics #366

TimDiekmann opened this issue Dec 16, 2017 · 9 comments · Fixed by #432
Assignees
Labels

Comments

@TimDiekmann
Copy link

On X11, even the most simple program crashes, when using a dead key. For example when inputting ^ + a, which should result in â. I used the german layout. and tested with latest version and with master.:

thread 'main' panicked at 'attempt to subtract with overflow'
src/platform/linux/x11/mod.rs:415:35

@francesca64 francesca64 self-assigned this Dec 17, 2017
@francesca64
Copy link
Member

I've created a branch where dead keys are handled correctly (at least, as far as I can tell). Could you try it and let me know if it's satisfactory?

@TimDiekmann
Copy link
Author

This works as intended, thank you.
Sidenote: The package libxkbcommon-x11-0 is not sufficient for Ubuntu, I had to install libxkbcommon-x11-dev.

@tbu-
Copy link

tbu- commented Jan 20, 2018

I also get this when using the compose key: compose key, ´, a and the program crashes.

thread 'main' panicked at 'attempt to subtract with overflow', .cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.9.0/src/platform/linux/x11/mod.rs:294:35

@francesca64
Copy link
Member

@tbu- this issue isn't resolved in master yet, as I've been a bit busy lately. I encourage you to try the branch I linked to above, since it's a significant change that would benefit from further testing.

@dbluhm
Copy link

dbluhm commented Feb 20, 2018

I'm indirectly using winit through Alacritty and ran into this problem when attempting to input Korean characters. Below is Alacritty's dependency list:

[dependencies]
libc = "0.2"
cgmath = "0.16"
notify = "4"
bitflags = "1"
font = { path = "./font" }
errno = "0.2"
parking_lot = "0.5"
serde = "1"
serde_derive = "1"
serde_json = "1"
serde_yaml = "0.7"
vte = "0.3"
mio = "0.6"
mio-more = "0.1"
copypasta = { path = "./copypasta" }
xdg = "2"
log = "0.4"
clap = "2"
fnv = "1"
unicode-width = "0.1"
arraydeque = "0.2"
glutin = "0.12"
clippy = { version = "*", optional = true }
env_logger = "0.5"
base64 = "0.9.0"

From what I could gather, glutin is the crate pulling winit in so I attempted manually specifying your branch as a dependency as follows:

[dependencies]
#...
arraydeque = "0.2"
winit = {git = "https://github.com/francesca64/winit", branch = "x11-kb-rewrite"}
glutin = "0.12" #winit dep is here
clippy = { version = "*", optional = true }
#...

I'm still not totally familiar with how Cargo handles dependencies so I totally understand if this was a naive and incorrect attempt lol but I still ended up hitting the same panic as before.

Backtrace:

thread 'main' panicked at 'attempt to subtract with overflow', /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:415:35
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:68
             at libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:380
   3: std::panicking::default_hook
             at libstd/panicking.rs:396
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:576
   5: std::panicking::begin_panic
             at libstd/panicking.rs:537
   6: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:521
   7: rust_begin_unwind
             at libstd/panicking.rs:497
   8: core::panicking::panic_fmt
             at libcore/panicking.rs:71
   9: core::panicking::panic
             at libcore/panicking.rs:51
  10: winit::platform::platform::x11::EventsLoop::process_event
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:415
  11: winit::platform::platform::x11::EventsLoop::poll_events
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:162
  12: winit::platform::platform::EventsLoop::poll_events
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/mod.rs:396
  13: winit::EventsLoop::poll_events
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/lib.rs:221
  14: alacritty::window::Window::poll_events
             at ./src/window.rs:270
  15: <alacritty::event::Processor<N>>::process_events
             at ./src/event.rs:427
  16: alacritty::run
             at src/main.rs:179
  17: alacritty::main
             at src/main.rs:62
  18: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  19: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:479
  20: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  21: std::rt::lang_start_internal
             at libstd/panicking.rs:458
             at libstd/panic.rs:358
             at libstd/rt.rs:58
  22: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  23: main
  24: __libc_start_main
  25: _start

See alacritty/alacritty#1113 for my original issue.

@francesca64
Copy link
Member

@dbluhm I think that would only work if you'd changed the dependency within glutin. Try adding this section to your Alacritty Cargo.toml:

[patch.crates-io]
winit = { git = "https://github.com/francesca64/winit", branch = "x11-kb-rewrite" }

and if that still doesn't work, then throw in a cargo update for good measure.

@dbluhm
Copy link

dbluhm commented Feb 23, 2018

@francesca64: after doing as you suggested, still getting the following backtrace:

thread 'main' panicked at 'attempt to subtract with overflow', /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:415:35
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::panicking::panic
             at /checkout/src/libcore/panicking.rs:51
  10: winit::platform::platform::x11::EventsLoop::process_event
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:415
  11: winit::platform::platform::x11::EventsLoop::poll_events
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/x11/mod.rs:162
  12: winit::platform::platform::EventsLoop::poll_events
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/platform/linux/mod.rs:396
  13: winit::EventsLoop::poll_events
             at /home/dbluhm/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.10.0/src/lib.rs:221
  14: alacritty::window::Window::poll_events
             at ./src/window.rs:270
  15: <alacritty::event::Processor<N>>::process_events
             at ./src/event.rs:427
  16: alacritty::run
             at src/main.rs:179
  17: alacritty::main
             at src/main.rs:62
  18: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  19: std::panicking::try::do_call
             at /checkout/src/libstd/rt.rs:59
             at /checkout/src/libstd/panicking.rs:480
  20: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:101
  21: std::rt::lang_start_internal
             at /checkout/src/libstd/panicking.rs:459
             at /checkout/src/libstd/panic.rs:365
             at /checkout/src/libstd/rt.rs:58
  22: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  23: main
  24: __libc_start_main
  25: _start

@b-r-u
Copy link
Contributor

b-r-u commented Feb 26, 2018

@dbluhm I think that you are still using the old winit version 0.10.0 from crates.io. The patch does not apply, because glutin 0.12.2 requires winit 0.10.0, but the fork from @francesca64 supplies winit 0.11.1.

@b-r-u
Copy link
Contributor

b-r-u commented Feb 27, 2018

@francesca64 I ran cargo run --example window on your branch and it panicked with Library libxkbcommon.so could not be loaded.. This looks like another issue with older library versions on Debian 8 (jessie). I created an issue for xkbcommon-dl: rust-windowing/xkbcommon-dl#1

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

Successfully merging a pull request may close this issue.

6 participants