Closed philippetev closed 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```
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
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
Probably Linux-related issue.
reproducible on macos too
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.
new version incoming. Almost made a really stupid mistake.
@philippetev can you validate if the latest version solves the issue? If so, we can close.
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
@JanDeDobbeleer same here on linux/zsh
@lnu it's really strange as I can't even come close to repo the first issue. But I'm looking into it.
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
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(),
}
}
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`
@JanDeDobbeleer so focused on the broken line I missed the nil check just below :smiley:
PS: fixed with 7.79.6
The reason I didn't catch this is because fish doesn't use oh-my-posh get xxx
.
@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 !
7.79.6 works like it should on both my devices. Thanks!
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.
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