Lf: [BUG] panic: runtime error: index out of range [1] with length 1

Created on 31 Aug 2020  路  3Comments  路  Source: gokcehan/lf

(Edited to clarify moment before error)

Good night and thank you for reading me!

I was just using LF, moving some files from directory to directory, when all of a sudden, LF freezes. As I cannot leave it, I close it by closing my terminal window. So I do try to do the same thing more 2 times, always closing LF when is completely frozen (I would understand if the files were heavy in dimension, but they were just some hundreds kB big). After this third time, I tried killall lf to see it would do it, and now I can't open LF anymore... I keep getting this error:

[marcosrdac@A515 ~]$ lf
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
main.(*app).readHistory(0xc000179000, 0x0, 0x0)
    github.com/gokcehan/lf/app.go:96 +0x514
main.run()
    github.com/gokcehan/lf/client.go:40 +0x23c
main.main()
    github.com/gokcehan/lf/main.go:187 +0xb9e

I don't have a clue about what exactly I have broken, but I tried reinstalling it and had no success. I also searched here for similar errors, but didn't find any (please, tell me if I'm wrong).

Also, I wasn't updating my system packages at any moment near to that time.

Please, tell me how you think I should approach this problem, I really like this program and know nothing about Go hahaha!

OS: Arch Linux
Installed LF from: AUR
shell: zsh

Thank you very much for your kind attention!

bug

All 3 comments

@marcosrdac It seems that our history file reading crashes for some reason. You can probably fix it if you delete the history file (i.e. ~/.local/share/lf/history). But before that, can you check the content of this file to see if you can see anything relevant that might trigger this behavior so I can fix the bug? I was thinking maybe there is an empty line, or a line without any prefixes, or something like that. You can also paste the content of the file here if you don't have anything personal.

Wow, you've done it!

I thought that my history file could be corrupted in some way, but I just saw regular entries... Until the 348th before-last line, in which there was no prefix, but the string "ect":

: rename contact
: rename product
: rename 2020_ficha_video_congresso_virtual_ufba.md
ect
: bkrn 
: bkrn 
: bkrn 

I didn't put it there manually, I must say. As a layman, I would suspect that brute killing all LF instances generated this writing error. Do you think it could be a problem while handling signals?

Thank you very much beforehand, @gokcehan!

@marcosrdac It's difficult to say how it happened. Maybe multiple clients tried to write to the same history file at the same time after you do killall and the file got corrupted. In any case, we should not crash in these cases. I now pushed a fix to simply skip those entries. Thanks for reporting.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mvrozanti picture mvrozanti  路  6Comments

nostdm picture nostdm  路  6Comments

gokcehan picture gokcehan  路  7Comments

rafi picture rafi  路  7Comments

davidarrieta picture davidarrieta  路  6Comments