hyprland-community/hyprland-autoname-workspaces

[BUG] crash when closing any application

pbosab opened this issue · 16 comments

Describe the bug
autoname crash when closing any application.

To Reproduce

  1. RUST_BACKTRACE=full hyprland-autoname-workspaces
  2. open any application
  3. close it

Linux Distro (please complete the following information):

  • arch
  • autoname: latest git
~ on  main [!] took 7s 
❯ RUST_BACKTRACE=full hyprland-autoname-workspaces
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `-1`, expected u32", line: 59, column: 13))', src/renamer/mod.rs:32:38
stack backtrace:
   0:     0x55e782d8185a - <unknown>
   1:     0x55e782da306e - <unknown>
   2:     0x55e782d7ec65 - <unknown>
   3:     0x55e782d81625 - <unknown>
   4:     0x55e782d82e0f - <unknown>
   5:     0x55e782d82b4b - <unknown>
   6:     0x55e782d8351c - <unknown>
   7:     0x55e782d832b9 - <unknown>
   8:     0x55e782d81d0c - <unknown>
   9:     0x55e782d82fc2 - <unknown>
  10:     0x55e782c34a33 - <unknown>
  11:     0x55e782c34ec3 - <unknown>
  12:     0x55e782c4c881 - <unknown>
  13:     0x55e782c8b0e7 - <unknown>
  14:     0x55e782c7dedc - <unknown>
  15:     0x55e782c80900 - <unknown>
  16:     0x55e782c6391c - <unknown>
  17:     0x55e782c66b97 - <unknown>
  18:     0x55e782c37183 - <unknown>
  19:     0x55e782c431c9 - <unknown>
  20:     0x55e782d7a0ac - <unknown>
  21:     0x55e782c67425 - <unknown>
  22:     0x7fd55787d790 - <unknown>
  23:     0x7fd55787d84a - __libc_start_main
  24:     0x55e782c35005 - <unknown>
  25:                0x0 - <unknown>

*edit: tried using a simple config like this:

# Add your icons mapping
# use double quote the key and the value
# take class name from 'hyprctl clients'
[icons]
"DEFAULT" = "-"
"foot" = ""
"Firefox Beta" = ""

[exclude]

same result

Very strange, it works well here with the last main and you example. I can't reproduce.
Does it works before ? 🤔 Can you find the last good commit for you ?

Does this happen when you open a lot of apps then close, or that happen with one app/window open also ?
Can you maybe try a cargo clean and cargo run again ?

Can you give me your rust version maybe, OS, architecture?

Very strange, it works well here with the last main and you example. I can't reproduce. Does it works before ? thinking Can you find the last good commit for you ?

it did but cant remember on what commit. not tonight, but tomorrow i'll surely search for the good commit.

Does this happen when you open a lot of apps then close, or that happen with one app/window open also ? Can you maybe try a cargo clean and cargo run again ?

even with 1 app/window, tried to clean cargo. nothing changed

Can you give me your rust version maybe, OS, architecture?

Arch Linux
6.2.2-zen1-1-zen
x86_64
rust 1:1.67.1-1

apparently i suck at rust (i've never done anything with it).
but looking at the AUR package i just have to make build and make install.
checking out the commit, build, install:

thread 'main' panicked at 'Unable to read config: "Unable to parse: Error { inner: ErrorInner { kind: Custom, line: Some(3), col: 0, at: Some(107), message: \"invalid type: map, expected a string\", key: [\"icons\"] } }"', src/main.rs:61:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

even with a commit that surely worked. am i doing something wrong?

  • autoanswer: yes, i didn't remove the [icons] in the config.

but after removing it, i still get:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `-1`, expected u32", line: 81, column: 13))', src/main.rs:110:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@pbosab can you try to build again the main please ? I try forcing back to my branch fork in case.

@pbosab can you try to build again the main please ? I try forcing back to my branch fork in case.

just done it, no changes

Crazy, do you have an old binary maybe in /usr/local/bin?

i have removed any binary manually yesterday when i was compiling by hand.

~ on  main [!] 
❯ sudo updatedb

~ on  main [!] 
❯ locate autoname
/home/pbo/.config/hyprland-autoname-workspaces
/home/pbo/.config/hyprland-autoname-workspaces/config.toml

and built again:

~ on  main [!] 
❯ yay -S hyprland-autoname-workspaces-git 
...
...
...
~ on  main [!] took 54s 
❯ hyprland-autoname-workspaces        
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `-1`, expected u32", line: 59, column: 13))', src/renamer/mod.rs:32:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

~ on  main [!] took 3s 
❯ 

just to be sure, i don't know how rust works, but are all these the same version as you?

  • Compiling proc-macro2 v1.0.51
  • Compiling quote v1.0.23
  • Compiling unicode-ident v1.0.6
  • Compiling syn v1.0.109
  • Compiling autocfg v1.1.0
  • Compiling libc v0.2.139
  • Compiling memchr v2.5.0
  • Compiling version_check v0.9.4
  • Compiling futures-core v0.3.26
  • Compiling cfg-if v1.0.0
  • Compiling futures-task v0.3.26
  • Compiling log v0.4.17
  • Compiling futures-channel v0.3.26
  • Compiling lock_api v0.4.9
  • Compiling slab v0.4.8
  • Compiling pin-project-lite v0.2.9
  • Compiling serde_derive v1.0.152
  • Compiling parking_lot_core v0.9.7
  • Compiling proc-macro-error-attr v1.0.4
  • Compiling futures-util v0.3.26
  • Compiling futures-sink v0.3.26
  • Compiling scopeguard v1.1.0
  • Compiling serde v1.0.152
  • Compiling rustversion v1.0.11
  • Compiling io-lifetimes v1.0.5
  • Compiling smallvec v1.10.0
  • Compiling heck v0.4.1
  • Compiling tokio v1.25.0
  • Compiling proc-macro-error v1.0.4
  • Compiling rustix v0.36.8
  • Compiling futures-io v0.3.26
  • Compiling pin-utils v0.1.0
  • Compiling bitflags v1.3.2
  • Compiling signal-hook-registry v1.4.1
  • Compiling socket2 v0.4.7
  • Compiling num_cpus v1.15.0
  • Compiling parking_lot v0.12.1
  • Compiling mio v0.8.6
  • Compiling num-traits v0.2.15
  • Compiling indexmap v1.9.2
  • Compiling paste v1.0.11
  • Compiling linux-raw-sys v0.1.4
  • Compiling async-trait v0.1.64
  • Compiling serde_json v1.0.93
  • Compiling bytes v1.4.0
  • Compiling doc-comment v0.3.3
  • Compiling dirs-sys v0.3.7
  • Compiling aho-corasick v0.7.20
  • Compiling signal-hook v0.3.15
  • Compiling hashbrown v0.12.3
  • Compiling convert_case v0.4.0
  • Compiling ryu v1.0.12
  • Compiling itoa v1.0.5
  • Compiling os_str_bytes v6.4.1
  • Compiling regex-syntax v0.6.28
  • Compiling clap_lex v0.3.2
  • Compiling dirs v4.0.0
  • Compiling inotify-sys v0.1.5
  • Compiling termcolor v1.2.0
  • Compiling strsim v0.10.0
  • Compiling is-terminal v0.4.4
  • Compiling hex v0.4.3
  • Compiling once_cell v1.17.1
  • Compiling lazy_static v1.4.0
  • Compiling xdg v2.4.1
  • Compiling rustc-hash v1.1.0
  • Compiling regex v1.7.1
  • Compiling futures-macro v0.3.26
  • Compiling tokio-macros v1.8.2
  • Compiling strum_macros v0.24.3
  • Compiling hyprland-macros v0.1.0 (https://github.com/cyrinux/hyprland-rs.git?branch=chore/read-all-socket-data#e7637507)
  • Compiling clap_derive v4.1.8
  • Compiling derive_more v0.99.17
  • Compiling strum v0.24.1
  • Compiling serde_repr v0.1.10
  • Compiling clap v4.1.8
  • Compiling futures-executor v0.3.26
  • Compiling futures v0.3.26
  • Compiling inotify v0.10.0
  • Compiling toml v0.5.11
  • Compiling hyprland v0.3.1 (https://github.com/cyrinux/hyprland-rs.git?branch=chore/read-all-socket-data#e7637507)
  • Compiling hyprland-autoname-workspaces v0.3.2

Yes look like you use the good one

think i've solved the mistery:
with hyprland works
with hyprland-git dont.

Ha cool, I will dig this this evening. This maybe mean they implement a new event not handle for the moment by hyprland-rs lib.

@pbosab for your info I open a PR with the patch to make it working with the last hyprland-git. If you rebuild again, you should get the fix now.

@cyrinux you sure it works? 'cuz mine isn't, same error.

Yes, it is for me do you use hyrpland-git or hyprland now? - I just try stable and -git, and its ok. Try a clean build again please ;)

still on -git, just did it, and no: error. 😢

❯ hyprland-autoname-workspaces
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SerdeError(Error("invalid value: integer `-1`, expected u32", line: 59, column: 13))', src/renamer/mod.rs:32:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

OMG, @pbosab sorry, got it, I still forgot to do cargo update before cargo build --release on my side to update the Cargo.lock.
We were not hiting the same commit on my branch fork for the lib.
As hyrpland-rs merge my pull request, I change it back to his repository.
Both hyprland and hyprland-rs are in active development so this move quick ...

Tell me if it is good for you now.

yup! now it works! thanks!!!