Skip to content

Panic with "unknown userid" and "runtime error: invalid memory address or nil pointer dereference" #191

Closed
@leira

Description

I installed lf through nix on gLinux, which is a debian based distribution within Google. When I launched lf, it panic'ed and printed:

2019/06/24 14:45:28 user: user: unknown userid 674665
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x56b17f]

goroutine 1 [running]:
main.init.3()
        /build/source/os.go:71 +0x7df

It seems it was triggered by the user.Current() call on os.go:57. It might be an error only happens with gLinux, as gLinux use a different way to authenticate users, I couldn't find an entry of my user in /etc/passwd. I will try to dig it further when I have time. ranger worked fine through.

I'm not familiar with golang through, it seems lf only uses gUser = user.Current() to get HomeDir and UserName. It did have $HOME and $USER check around os.go:60, but it didn't use them. Maybe refactor gUser into gHomeDir and gUserName, and take the values from $HOME and $USER when user.Current() fails? Or at least fail on the spot rather than trigger a panic later on?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions