greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.81k stars 472 forks source link

Zero division #2063

Closed Smok1e closed 2 weeks ago

Smok1e commented 2 weeks ago

Everything went find until i updated some packages and now i can see only "Error: status_command process exited unexpectedly (exit 101)".

If i run i3status-rs with RUST_BACKTRACE=full, i can see the issue is in time.rs:117 in zero division.

image

cfsmp3 commented 2 weeks ago

What's your config for this block? The default interval is 10.

On Mon, Jun 17, 2024, 17:29 Smok1e @.***> wrote:

Everything went find until i updated some packages and now i can see only "Error: status_command process exited unexpectedly (exit 101)".

If i run i3status-rs with RUST_BACKTRACE=full, i can see the issue is in time.rs:117 https://github.com/greshake/i3status-rust/blob/master/src/blocks/time.rs#L117C13-L117C60 in zero division.

image.png (view on web) https://github.com/greshake/i3status-rust/assets/33802666/a8645b02-0e0e-40a6-89fd-8f10ced801ff

— Reply to this email directly, view it on GitHub https://github.com/greshake/i3status-rust/issues/2063, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNMTWOLBGXX6EFZWTMJAXTZH36FBAVCNFSM6AAAAABJOHVRMCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2TONRTGQZDMMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Smok1e commented 2 weeks ago

Thank you for quick reply. If that is what you are looking for, interval in "time" block in my config.toml is set to 0.5. Here is the whole config.toml:

[theme]
theme = "modern"

# [theme.overrides]
# idle_fg = "#2e000800"
# idle_bg = "#00000000F"

[icons]
icons = "none"

[[block]]
block = "amd_gpu"
format = " $icon $utilization $vram_used/$vram_total "

[[block]]
block = "cpu"
format = " $icon $utilization $frequency.eng(w:4) "
interval = 0.7

[[block]]
block = "memory"
format = " $icon $mem_used.eng(w:4)/$mem_total.eng(w:4) $mem_used_percents.eng(w:4) "
format_alt = " $icon_swap $swap_free.eng(w:3,u:B,p:M)/$swap_total.eng(w:3,u:B,p:M)($swap_used_percents.eng(w:2)) "
interval = 5

[[block]]
block = "disk_space"
path = "/home/smok1e"
info_type = "available"
format = " home $used/$total "
alert_unit = "GB"
interval = 20
[[block.click]]
button = "left"
cmd = "thunar /home/bpm140"

[[block]]
block = "disk_space"
path = "/"
info_type = "available"
format = " root $used/$total "
interval = 20
[[block.click]]
button = "left"
cmd = "thunar /mnt/projects"

[[block]]
block = "sound"

[[block.click]]
button = "left"
cmd = "pavucontrol"

[[block]]
block = "time"
interval = 0.5
format = " $timestamp.datetime(f:'%d.%m.%Y %T') "

[[block]]
block = "battery"
format = " pentagon hacked on {$percentage} "

[[block]]
block = "custom"
command = "whoami"
interval = 999999
Smok1e commented 2 weeks ago

Okay, i just set interval to 1 and everything works just fine. I suppose 0.5 was rounded to 0 causing division error. I don't know why i have set it to 0.5 and why that just worked before this moment

MaxVerevkin commented 2 weeks ago

Thanks for the report, fixed.