hyprland-autoname-workspaces: [BUG] hyprland-autoname-workspace crashes when new workspace/client name includes character '/'

Describe the bug When I try to change name of client to include forward slash ‘/’, hyprland-autoname-workspace crashes. Goal is to add colors dynamically to waybar, something like hyprctl dispatch renameworkspace 6 '<span color="blue">6</span>' works. To Reproduce Steps to reproduce the behavior:

  1. Add to your config something like: "(?i)Kitty" = '/'
  2. run hyprland-autoname-workspaces
  3. crash

Expected behavior Rename the client to /, do not crash

Linux Distro (please complete the following information): Arch

**Program version?

tag 0.4.4, commit 09a64e38ccf0b7ba2a1501faf8794432c9ab97be Additional context

> RUST_BACKTRACE=full cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/hyprland-autoname-workspaces`
thread 'main' panicked at 'App can't rename workspaces on st   0:     0x55d058a6153a - std::backtrace_rs::backtrace::libstack backtrace:
98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:692:13
unwind::trace::h38953cd7b82c38d3
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55d058a6153a - std::backtrace_rs::backtrace::trace_unsynchronized::h53802a8b087ae509
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55d058a6153a - std::sys_common::backtrace::_print_fmt::h0806bc2b3dfbb06c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x55d058a6153a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6bd42fa772461846
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55d058a828be - core::fmt::write::h086d90dd8e1b1a3f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/fmt/mod.rs:1232:17
   5:     0x55d058a5e845 - std::io::Write::write_fmt::h18f12173b1839b43
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/io/mod.rs:1684:15
   6:     0x55d058a61305 - std::sys_common::backtrace::_print::hfeb1e373746d03b6
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x55d058a61305 - std::sys_common::backtrace::print::h9dc79345d5a578b2
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x55d058a62abf - std::panicking::default_hook::{{closure}}::h45526a9efda640f6
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:271:22
   9:     0x55d058a627fb - std::panicking::default_hook::h3e08227c1528c168
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:290:9
  10:     0x55d058a63068 - std::panicking::rust_panic_with_hook::he81c02edd7e7b80e
                               at /rustc/84c898d65adf2f39a5aer::{{closure}}::h98331a6e5528817d
  11:     0x55d058a62f69 - std::panicking::begin_panic_handl  23:     0x55d058a5963c - std::panicking::try::h5074e9976b1                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:583:13
  12:     0x55d058a619a6 - std::sys_common::backtrace::__rust_end_short_backtrace::h83c0d32dd2d13f12
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:150:18
  13:     0x55d058a62c72 - rust_begin_unwind
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
  14:     0x55d0585c9aa3 - core::panicking::panic_fmt::h9ad38cbb8980e66e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
  15:     0x55d0585c9f53 - core::result::unwrap_failed::h6787e69082462417
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
  16:     0x55d0585f59be - core::result::Result<T,E>::expect::h7a233c435d697425
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1047:23
  17:     0x55d0586201b9 - hyprland_autoname_workspaces::main::h539590fcc564dce9
                               at /home/psimovec/test/hyprland-autoname-workspaces/src/main.rs:20:5
  18:     0x55d05862228b - core::ops::function::FnOnce::call_once::h839c23dcd80ffa6e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
  19:     0x55d05860646e - std::sys_common::backtrace::__rust_begin_short_backtrace::h0def45c3f2f047f3
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:134:18
  20:     0x55d058608ea1 - std::rt::lang_start::{{closure}}::h5feba351e3d9119c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:166:18
  21:     0x55d058a5963c - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h814f0ad687ab2f92
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:287:13
  22:     0x55d058a5963c - std::panicking::try::do_call::had9b6a5cabf2fdc8
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
                               at /rustc/84c898d65adf2f39a5a3e92c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  24:     0x55d058a5963c - std::panic::catch_unwind::he1669253985d4352
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  25:     0x55d058a5963c - std::rt::lang_start_internal::{{closure}}::hd778e2099ecb758e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:148:48
  26:     0x55d058a5963c - std::panicking::try::do_call::h1ce263ca927523fa
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  27:     0x55d058a5963c - std::panicking::try::he3d901a7a8ca0bfd
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  28:     0x55d058a5963c - std::panic::catch_unwind::hb9e5b8ae73c93b8f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  29:     0x55d058a5963c - std::rt::lang_start_internal::h2947494479068ade
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:148:20
  30:     0x55d058608e7a - std::rt::lang_start::he46f5779c6465a34
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:165:17
  31:     0x55d0586203be - main
  32:     0x7f1bca3cb790 - <unknown>
  33:     0x7f1bca3cb84a - __libc_start_main
  34:     0x55d0585ca135 - _start
  35:                0x0 - <unknown>```

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Super @maximbaz come to the help

image

I do the PR to hyprland-rs, all debugging credit to @maximbaz ❤️

@yavko do you have an idea an idea about the problem ? We try to be able to use hyprland-rs rename dispatcher to pass some special char like / at least, and maybe <>.

No clue, hyprland-rs doesn’t do anything with slashes afaik

@psimovec for now if you like we can do this tricks https://github.com/cyrinux/hyprland-autoname-workspaces/pull/42 to prevent the crash and draw a kindof slash. But we can’t use <span></span> for the moment so. This is maybe a hyprland-rs issue but I can’t put the finger on for the moment.

@yavko do you have an idea an idea about the problem ? We try to be able to use hyprland-rs rename dispatcher to pass some special char like / at least, and maybe <>.

I just need to clarify that <> characters work as expected.

NotOkDispatch

No this looks like a valid toml syntax now but maybe another bug in the hyrland-rs lib. I will dig more.

Interesting thinking I search the good rust regex syntax.

I found somewhere that ‘/’ is just a normal character in Rust regex, so it doesn’t need to be escaped. So I guess the question is why it crashes for not escaped ‘/’

Yeah I read the same, in the same time, why are we regexing here. Do you confirm you well want ‘/’ as “instead” of an icon for example here?

Are you QA engineer? Thanks smile

I used to be QE intern for 2 years smile

Feel free to polish the README please when you will be hyprland-autoname-workspaces expert 🙏🏻

Are you QA engineer? Thanks smile

I used to be QE intern for 2 years 😄