JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.38k stars 2.39k forks source link

Weird messages after updating to 7.79.3 #2238

Closed philippetev closed 2 years ago

philippetev commented 2 years ago

Code of Conduct

What happened?

Started right after the update to the latest version 7.79.3 There is no error initially when I login. The errors appear when I issue some command.

This is bash 5.1.16 on Ubuntu 22.04 Server. Same messages on my NAS (Linux arm64, bash 5.x). No such messages with the same version on Windows 10/11 and Powershell. Probably Linux-related issue. No such messages with the previous version 7.79.2 on both my Ubuntu Server and my NAS.

Theme

philip.omp.zip

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Log output

oh-my-posh debug
panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x77a701]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Trace(0x7f7ed8bfb108?, {0x10?, 0x1580ca0?, 0x15805c0?}, {0xb4fb9d?, 0x8?}, {0x0?, 0xc00011dbd7?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:300 +0x41
panic({0xab5e00, 0x1569100})
        /opt/hostedtoolcache/go/1.18.1/x64/src/runtime/panic.go:838 +0x207
oh-my-posh/environment.(*ShellEnvironment).Init(0xc000060f00)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x1574f80?, {0xc0001ef950, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x1574f80, {0xc0001ef920, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1573b80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0xc6e1f0?, 0xc000002340?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x4a
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x27

Version: 7.79.3

Segments:

ConsoleTitle(true) -   2 ms - philip in ~
text(true)     -   1 ms - ┌
text(false)    -   0 ms -
session(true)  -   0 ms - [buildroot]
path(true)     -   0 ms - [ﮟ]
text(true)     -   0 ms - └
session(true)  -   1 ms - [philip]
exit(true)     -   1 ms - 

Run duration: 9.726106ms

Cache path: /home/philip/.cache/oh-my-posh

Config path: /home/philip/.themes/philip.omp.json

Logs:

2022/05/07 21:30:35 debug: Getenv

2022/05/07 21:30:35 Getenv duration: 37.301µs, args: XDG_CACHE_HOME
2022/05/07 21:30:35 CachePath duration: 84.101µs, args:
2022/05/07 21:30:35 debug: Getenv
/home/philip/.themes/philip.omp.json
2022/05/07 21:30:35 Getenv duration: 20.9µs, args: POSH_THEME
2022/05/07 21:30:35 resolveConfigPath duration: 29.5µs, args:
2022/05/07 21:30:35 Init duration: 259.803µs, args:
2022/05/07 21:30:35 Flags duration: 300ns, args:
2022/05/07 21:30:35 config.loadConfig duration: 835.409µs, args:
2022/05/07 21:30:35 Flags duration: 200ns, args:
2022/05/07 21:30:35 debug: Getenv

2022/05/07 21:30:35 Getenv duration: 3.9µs, args: OMP_CACHE_DISABLED
2022/05/07 21:30:35 Root duration: 7.2µs, args:
2022/05/07 21:30:35 Shell duration: 1.231514ms, args:
2022/05/07 21:30:35 ErrorCode duration: 300ns, args:
2022/05/07 21:30:35 debug: Getenv

2022/05/07 21:30:35 Getenv duration: 6.8µs, args: WSL_DISTRO_NAME
2022/05/07 21:30:35 IsWsl duration: 16.6µs, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 61.6µs, args:
2022/05/07 21:30:35 PathSeparator duration: 300ns, args:
2022/05/07 21:30:35 PathSeparator duration: 200ns, args:
2022/05/07 21:30:35 debug: User
philip
2022/05/07 21:30:35 User duration: 5.1µs, args:
2022/05/07 21:30:35 debug: Host
buildroot
2022/05/07 21:30:35 Host duration: 12.9µs, args:
2022/05/07 21:30:35 GOOS duration: 400ns, args:
2022/05/07 21:30:35 TemplateCache duration: 1.450416ms, args:
2022/05/07 21:30:35 Flags duration: 400ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 10.3µs, args:
2022/05/07 21:30:35 GOOS duration: 300ns, args:
2022/05/07 21:30:35 TemplateCache duration: 300ns, args:
2022/05/07 21:30:35 TemplateCache duration: 700ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 6.2µs, args:
2022/05/07 21:30:35 GOOS duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 500ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 7.9µs, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 debug: Getenv
192.168.0.5 51614 192.168.0.111 22
2022/05/07 21:30:35 Getenv duration: 3.301µs, args: SSH_CONNECTION
2022/05/07 21:30:35 TemplateCache duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 500ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 5.3µs, args:
2022/05/07 21:30:35 GOOS duration: 200ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 2.3µs, args:
2022/05/07 21:30:35 Flags duration: 300ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 4.6µs, args:
2022/05/07 21:30:35 GOOS duration: 200ns, args:
2022/05/07 21:30:35 GOOS duration: 300ns, args:
2022/05/07 21:30:35 GOOS duration: 300ns, args:
2022/05/07 21:30:35 GOOS duration: 200ns, args:
2022/05/07 21:30:35 GOOS duration: 300ns, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 PathSeparator duration: 200ns, args:
2022/05/07 21:30:35 Flags duration: 200ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 2.6µs, args:
2022/05/07 21:30:35 GOOS duration: 200ns, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 GOOS duration: 0s, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 GOOS duration: 0s, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 PathSeparator duration: 100ns, args:
2022/05/07 21:30:35 PathSeparator duration: 100ns, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 debug: Getenv

2022/05/07 21:30:35 Getenv duration: 3µs, args: WSL_DISTRO_NAME
2022/05/07 21:30:35 IsWsl duration: 7.8µs, args:
2022/05/07 21:30:35 StackCount duration: 300ns, args:
2022/05/07 21:30:35 TemplateCache duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 600ns, args:
2022/05/07 21:30:35 Flags duration: 200ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 3.3µs, args:
2022/05/07 21:30:35 GOOS duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 100ns, args:
2022/05/07 21:30:35 TemplateCache duration: 700ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 9.7µs, args:
2022/05/07 21:30:35 GOOS duration: 300ns, args:
2022/05/07 21:30:35 debug: Getenv
192.168.0.5 51614 192.168.0.111 22
2022/05/07 21:30:35 Getenv duration: 5.7µs, args: SSH_CONNECTION
2022/05/07 21:30:35 TemplateCache duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 400ns, args:
2022/05/07 21:30:35 TemplateCache duration: 500ns, args:
2022/05/07 21:30:35 debug: Pwd
/home/philip
2022/05/07 21:30:35 Pwd duration: 4.3µs, args:
2022/05/07 21:30:35 GOOS duration: 100ns, args:
2022/05/07 21:30:35 ErrorCode duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 200ns, args:
2022/05/07 21:30:35 TemplateCache duration: 500ns, args:
2022/05/07 21:30:35 TemplateCache duration: 200ns, args:
2022/05/07 21:30:35 debug: Getenv

2022/05/07 21:30:35 Getenv duration: 2.8µs, args: XDG_CACHE_HOME
2022/05/07 21:30:35 CachePath duration: 54.901µs, args:
2022/05/07 21:30:35 Flags duration: 100ns, args:
panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x77a701]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Trace(0x7f761b6095b8?, {0x10?, 0x1580ca0?, 0x15805c0?}, {0xb4fb9d?, 0x8?}, {0x0?, 0xc0000d5bd7?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:300 +0x41
panic({0xab5e00, 0x1569100})
        /opt/hostedtoolcache/go/1.18.1/x64/src/runtime/panic.go:838 +0x207
oh-my-posh/environment.(*ShellEnvironment).Init(0xc0000b4ea0)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x1574f80?, {0xc0001ad920, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x1574f80, {0xc0001ad8f0, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1573b80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0xc6e1f0?, 0xc000002340?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x4a
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x27
Fammy commented 2 years ago

I get similar messages on an arm64 Raspberry Pi (running Pi OS 64 bit):


        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x33932c]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Trace(0x7f95d37a68?, {0x10?, 0x400013db78?, 0x110b3e0?}, {0x6d37b4?, 0x400011ce49?}, {0x0?, 0x950000000014fdc0?, 0x400013db28?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:300 +0x2c
panic({0x639ba0, 0x10f3f20})
        /opt/hostedtoolcache/go/1.18.1/x64/src/runtime/panic.go:838 +0x20c
oh-my-posh/environment.(*ShellEnvironment).Init(0x400011cea0)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x6c
oh-my-posh/cli.glob..func7(0x10ffde0?, {0x4000215920, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x84
github.com/spf13/cobra.(*Command).execute(0x10ffde0, {0x40002158f0, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x4c4
github.com/spf13/cobra.(*Command).ExecuteC(0x10fe9e0)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x360
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0x7f49e8?, 0x40000021a0?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x6c
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x38```
PapiPeppers commented 2 years ago

Same issue on m1 macOS:

⎧ ⟨❤⟩                                                                                                         ⟨0ms⟩ ⎫
⎩⟩⟩⟩⟩⟩⟩ exec zsh                                                                                         ⟨19:29:17⟩ ⎭
panic: runtime error: invalid memory address or nil pointer dereference
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x81 pc=0x100460b6c]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Trace(0x1015885b8?, {0x10?, 0x14000175b78?, 0x10120ae60?}, {0x1006c7d97?, 0x14000138ae9?}, {0x0?, 0x5000000100270b44?, 0x14000175b28?})
    /private/tmp/oh-my-posh-20220507-90939-12njmwa/oh-my-posh-7.79.3/src/environment/shell.go:300 +0x2c
panic({0x10086c6c0, 0x1011f3fb0})
    /opt/homebrew/Cellar/go/1.18.1/libexec/src/runtime/panic.go:838 +0x204
oh-my-posh/environment.(*ShellEnvironment).Init(0x14000138b40)
    /private/tmp/oh-my-posh-20220507-90939-12njmwa/oh-my-posh-7.79.3/src/environment/shell.go:232 +0x6c
oh-my-posh/cli.glob..func7(0x1011ffbc0?, {0x140002039c0, 0x1?, 0x1?})
    /private/tmp/oh-my-posh-20220507-90939-12njmwa/oh-my-posh-7.79.3/src/cli/get.go:34 +0x84
github.com/spf13/cobra.(*Command).execute(0x1011ffbc0, {0x14000203990, 0x1, 0x1})
    /Users/william/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x4ac
github.com/spf13/cobra.(*Command).ExecuteC(0x1011fe7c0)
    /Users/william/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x354
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/william/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0x1007e5694?, 0x140000021a0?})
    /private/tmp/oh-my-posh-20220507-90939-12njmwa/oh-my-posh-7.79.3/src/cli/root.go:40 +0x6c
main.main()
    /private/tmp/oh-my-posh-20220507-90939-12njmwa/oh-my-posh-7.79.3/src/main.go:10 +0x30
SanityCoding commented 2 years ago

Same issue wsl2 (and gitforwindows), bash shell:

panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x77a701]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Trace(0x7fd3bd2645b8?, {0x10?, 0x1580ca0?, 0x15805c0?}, {0xb4fb9d?, 0x8?}, {0x0?, 0xc000157bd7?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:300 +0x41
panic({0xab5e00, 0x1569100})
        /opt/hostedtoolcache/go/1.18.1/x64/src/runtime/panic.go:838 +0x207
oh-my-posh/environment.(*ShellEnvironment).Init(0xc000137080)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x1574f80?, {0xc00022d930, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x1574f80, {0xc00022d900, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1573b80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0xc6e1f0?, 0xc0000021a0?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x4a
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x27

Also get the same on Win 11 Terminal Powershell, when running the oh-my-posh get shell Command:

panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x81 pc=0x1230ae1]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Trace(0x10?, {0x1?, 0x24d6bf82db9?, 0x20608a0?}, {0x16110ea?, 0xc000066ae9?}, {0x0?, 0x10?, 0x2030000?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:300 +0x41
panic({0x1573fe0, 0x2048300})
        /opt/hostedtoolcache/go/1.18.1/x64/src/runtime/panic.go:838 +0x207
oh-my-posh/environment.(*ShellEnvironment).Init(0xc000066b40)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x2053dc0?, {0xc0001e7890, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x2053dc0, {0xc0001e7860, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x20529c0)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0x173e094?, 0xc00004c000?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x4a
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x27
Magniquick commented 2 years ago

Probably Linux-related issue.

reproducible on macos too

JanDeDobbeleer commented 2 years ago

Just got up, will fix right after breakfast. Weird how I didn't catch that while doing this change, the mitigation is to stay on one version below. Sorry for this.

JanDeDobbeleer commented 2 years ago

new version incoming. Almost made a really stupid mistake.

JanDeDobbeleer commented 2 years ago

@philippetev can you validate if the latest version solves the issue? If so, we can close.

akunzai commented 2 years ago

Hi @JanDeDobbeleer

I still got runtime errors after upgrade to 7.79.5

$ oh-my-posh debug
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x438a15c]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Init(0xc00007eba0)
    /private/tmp/oh-my-posh-20220508-18559-1u278oy/oh-my-posh-7.79.5/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x517c380?, {0xc0001db9f0, 0x1?, 0x1?})
    /private/tmp/oh-my-posh-20220508-18559-1u278oy/oh-my-posh-7.79.5/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x517c380, {0xc0001db9c0, 0x1, 0x1})
    /Users/akunzai/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x517af80)
    /Users/akunzai/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/akunzai/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0x486c914?, 0xc0000021a0?})
    /private/tmp/oh-my-posh-20220508-18559-1u278oy/oh-my-posh-7.79.5/src/cli/root.go:40 +0x4a
main.main()
    /private/tmp/oh-my-posh-20220508-18559-1u278oy/oh-my-posh-7.79.5/src/main.go:10 +0x27

Version: 7.79.5

Segments:

ConsoleTitle(true)   -   0 ms -  :: zsh
dotnet(false)        -   0 ms -
java(false)          -   0 ms -
node(false)          -   0 ms -
php(false)           -   0 ms -
path(true)           -   0 ms - ~
git(false)           -   0 ms -
executiontime(false) -   0 ms -
exit(false)          -   0 ms -
time(true)           -   0 ms - | 14:02:46
session(true)        -   0 ms -  akunzai@Charley-Macmini
text(true)           -   0 ms - $

Run duration: 3.862375ms

Cache path: /Users/akunzai/.cache/oh-my-posh

Config path: /Users/akunzai/.poshthemes/akunzai.omp.json
lnu commented 2 years ago

@JanDeDobbeleer same here on linux/zsh

JanDeDobbeleer commented 2 years ago

@lnu it's really strange as I can't even come close to repo the first issue. But I'm looking into it.

Magniquick commented 2 years ago

still errors

>oh-my-posh --version                                                
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x81 pc=0x102d13fdc]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Init(0x14000092ba0)
    /private/tmp/oh-my-posh-20220508-2583-saw22e/oh-my-posh-7.79.5/src/environment/shell.go:232 +0x6c
oh-my-posh/cli.glob..func7(0x103ab3bc0?, {0x140001e19f0, 0x1?, 0x1?})
    /private/tmp/oh-my-posh-20220508-2583-saw22e/oh-my-posh-7.79.5/src/cli/get.go:34 +0x84
github.com/spf13/cobra.(*Command).execute(0x103ab3bc0, {0x140001e19c0, 0x1, 0x1})
    /Users/var/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x4ac
github.com/spf13/cobra.(*Command).ExecuteC(0x103ab27c0)
    /Users/var/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x354
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/var/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0x103099694?, 0x140000021a0?})
    /private/tmp/oh-my-posh-20220508-2583-saw22e/oh-my-posh-7.79.5/src/cli/root.go:40 +0x6c
main.main()
    /private/tmp/oh-my-posh-20220508-2583-saw22e/oh-my-posh-7.79.5/src/main.go:10 +0x30
7.79.5

macos + zsh

lnu commented 2 years ago

fixed with: oh-my-posh/src/environment/shell.go - 232

func (env *ShellEnvironment) Init() {
    defer env.Trace(time.Now(), "Init")
    if env.CmdFlags.Debug {
        log.SetOutput(&env.logBuilder)
    }
    if env.CmdFlags == nil {
        env.CmdFlags = &Flags{}
    }
    env.fileCache = &fileCache{}
    env.fileCache.Init(env.CachePath())
    env.resolveConfigPath()
    env.cmdCache = &commandCache{
        commands: newConcurrentMap(),
    }
}

so related to this line but have to find the real fix

so should be this:

func (env *ShellEnvironment) Init() {
    defer env.Trace(time.Now(), "Init")
    if env.CmdFlags != nil && env.CmdFlags.Debug {
        log.SetOutput(&env.logBuilder)
    }
    if env.CmdFlags == nil {
        env.CmdFlags = &Flags{}
    }
    env.fileCache = &fileCache{}
    env.fileCache.Init(env.CachePath())
    env.resolveConfigPath()
    env.cmdCache = &commandCache{
        commands: newConcurrentMap(),
    }
}
philippetev commented 2 years ago

Same here (with 7.79.5)

oh-my-posh version
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x779a9c]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Init(0xc000060f00)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x1574f80?, {0xc0001ef950, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x1574f80, {0xc0001ef920, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1573b80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0xc6e1f0?, 0xc000002340?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x4a
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x27
7.79.5
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x81 pc=0x779a9c]

goroutine 1 [running]:
oh-my-posh/environment.(*ShellEnvironment).Init(0xc000060f00)
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:232 +0x7c
oh-my-posh/cli.glob..func7(0x1574f80?, {0xc0001ef950, 0x1?, 0x1?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/get.go:34 +0x9b
github.com/spf13/cobra.(*Command).execute(0x1574f80, {0xc0001ef920, 0x1, 0x1})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1573b80)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
oh-my-posh/cli.Execute({0xc6e1f0?, 0xc000002340?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/cli/root.go:40 +0x4a
main.main()
        /home/runner/work/oh-my-posh/oh-my-posh/src/main.go:10 +0x27`
lnu commented 2 years ago

@JanDeDobbeleer so focused on the broken line I missed the nil check just below :smiley:

PS: fixed with 7.79.6

JanDeDobbeleer commented 2 years ago

The reason I didn't catch this is because fish doesn't use oh-my-posh get xxx.

Magniquick commented 2 years ago

@JanDeDobbeleer so focused on the broken line I missed the nil check just below 😃

PS: fixed with 7.79.6

Hasn't been pushed to brew atm : (

EDIT - IT'S UP !

philippetev commented 2 years ago

7.79.6 works like it should on both my devices. Thanks!

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.