pitop icon indicating copy to clipboard operation
pitop copied to clipboard

runtime error - panic: runtime error: slice bounds out of range [:4] with length 3

Open RajaRuling opened this issue 2 years ago • 3 comments

Hi , I get the following error when running pitop. Please assist...

_panic: runtime error: slice bounds out of range [:4] with length 3

goroutine 24 [running]:
github.com/PierreKieffer/pitop/pkg/disk.ExtractDiskUsage(0x0)
/home/rpi/go/src/github.com/PierreKieffer/pitop/pkg/disk/disk.go:37 +0x41c
github.com/PierreKieffer/pitop/pkg/worker.Worker.func5(0x400011e360, 0x4000106420)
/home/rpi/go/src/github.com/PierreKieffer/pitop/pkg/worker/worker.go:55 +0x48
created by github.com/PierreKieffer/pitop/pkg/worker.Worker
/home/rpi/go/src/github.com/PierreKieffer/pitop/pkg/worker/worker.go:53 +0x124
_

My df -h output

Filesystem Size Used Avail Use% Mounted on
dev 1.7G 0 1.7G 0% /dev
none 117G 40G 72G 36% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 107M 1.8G 6% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/loop1 49M 49M 0 100% /snap/core18/2252
/dev/loop2 231M 231M 0 100% /snap/nextcloud/28662
/dev/loop3 147M 147M 0 100% /snap/gnome-3-28-1804/160
/dev/loop4 89M 89M 0 100% /snap/core/11996
/dev/loop5 231M 231M 0 100% /snap/nextcloud/28715
/dev/loop6 66M 66M 0 100% /snap/gtk-common-themes/1519
/dev/loop7 128K 128K 0 100% /snap/bare/5
/dev/mmcblk0p1 127M 83M 44M 66% /boot
/dev/sda1 1.9T 1.7T 166G 92% /media/exfat
tmpfs 372M 0 372M 0% /run/user/1000

RajaRuling avatar Jan 12 '22 09:01 RajaRuling

Hi @RajaRuling, thank you for the report. I will see what I can do

PierreKieffer avatar Jan 12 '22 11:01 PierreKieffer

Hi @RajaRuling Can you give me the specifications of the environment you are running on? Which Raspberry? Which OS? 32 or 64 bit? Thks

PierreKieffer avatar Jan 12 '22 11:01 PierreKieffer

Hi PierreKieffer/pitop,

Raspberry pi 4b model

Raspian lite 64 bit OS

I was able to fix this myself in cloned copy of git code 23rd line of disk.go file. It is working now correctly after rebuilding and running.

/pitop/pkg/disk/disk.go 23: cmd := "df -h | grep ^\/"

Thanks

RajaRuling avatar Jan 14 '22 05:01 RajaRuling