oh-my-posh: Seg fault error at `runtime/debug/stack.go` after update
Code of Conduct
- I agree to follow this project’s Code of Conduct
What happened?
Ran the following command to update, then received seg fault error from oh-my-posh for every command thereafter:
Start-Process -FilePath pwsh.exe -ArgumentList @('-NonInteractive','-NoProfile','-NoLogo','-Command "winget upgrade --all --include-unknown"') -Verb RunAs
Here is the seg fault error:
oh-my-posh fatal error rendering session segment:runtime error: invalid memory address or nil pointer dereference
goroutine 18 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.18.0/x64/src/runtime/debug/stack.go:24 +0x65
oh-my-posh/engine.(*Segment).renderText.func1()
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:326 +0x58
panic({0xe50b40, 0x1906900})
/opt/hostedtoolcache/go/1.18.0/x64/src/runtime/panic.go:838 +0x207
strings.Count({0x0?, 0xc00005aae0?}, {0xeea548?, 0xc0001ed110?})
/opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:47 +0x50
strings.Replace({0x0, 0xe}, {0xeea548, 0x1}, {0xeea532, 0x1}, 0xffffffffffffffff)
/opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:1003 +0xcf
strings.ReplaceAll(...)
/opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:1037
oh-my-posh/environment.DirMatchesOneOf({0x10202f0, 0xc0000be000}, {0x0?, 0xe?}, {0x1973d40, 0x0, 0x0?})
/home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:724 +0x76
oh-my-posh/engine.(*Segment).cwdExcluded(0xc000296000)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:209 +0xde
oh-my-posh/engine.(*Segment).shouldIncludeFolder(0xc000296000)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:182 +0x36
oh-my-posh/engine.(*Segment).renderText(0xc000296000, {0x10202f0?, 0xc0000be000?})
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:332 +0x7b
oh-my-posh/engine.(*Block).renderSegmentsText.func1(0x0?)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:88 +0x65
created by oh-my-posh/engine.(*Block).renderSegmentsText
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:86 +0x98
Similar to #1586
Theme
Modified from jandedobbeleer.omp.json.
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#c386f1",
"foreground": "#ffffff",
"leading_diamond": "\ue0b6",
"properties": {
"display_host": false
},
"style": "diamond",
"template": " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }} ",
"trailing_diamond": "\ue0b0",
"type": "session"
},
{
"background": "#ff479c",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"folder_separator_icon": " \ue0b1 ",
"home_icon": "~",
"style": "folder"
},
"style": "powerline",
"template": " \uf74a {{ .Path }} ",
"type": "path"
},
{
"background": "#fffb38",
"foreground": "#193549",
"foreground_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#ff9248{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}",
"{{ if gt .Ahead 0 }}#f17c37{{ end }}",
"{{ if gt .Behind 0 }}#89d1dc{{ end }}"
],
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_stash_count": true,
"fetch_upstream_icon": true
},
"style": "powerline",
"template": " {{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}}\uf692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }} ",
"type": "git"
},
{
"background": "#6CA35E",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true
},
"style": "powerline",
"template": " \uf898 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
"type": "node"
},
{
"background": "#8ED1F7",
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true
},
"style": "powerline",
"template": " \ue626 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "go"
},
{
"background": "#4063D8",
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_version": true
},
"style": "powerline",
"template": " \ue624 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "julia"
},
{
"background": "#FFDE57",
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": true,
"fetch_virtual_env": false
},
"style": "powerline",
"template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }} ",
"type": "python"
},
{
"background": "#0077c2",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"style": "powerline",
"template": " {{ .Status }} ",
"type": "poshgit"
},
{
"background": "#AE1401",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": true
},
"style": "powerline",
"template": " \ue791 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "ruby"
},
{
"background": "#FEAC19",
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"display_mode": "files",
"fetch_version": false
},
"style": "powerline",
"template": " \uf0e7{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
"type": "azfunc"
},
{
"background_templates": [
"{{if contains \"default\" .Profile}}#FFA400{{end}}",
"{{if contains \"jan\" .Profile}}#f1184c{{end}}"
],
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
"display_default": false
},
"style": "powerline",
"template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
"type": "aws"
},
{
"background": "#ffff66",
"foreground": "#111111",
"powerline_symbol": "\ue0b0",
"properties": {
"root_icon": "\uf0ad"
},
"style": "powerline",
"template": " \uf0e7 ",
"type": "root"
},
{
"background": "#83769c",
"foreground": "#ffffff",
"properties": {
"always_enabled": true
},
"style": "plain",
"template": "<transparent>\ue0b0</> \ufa1e{{ .FormattedMs }}\u2800",
"type": "executiontime"
},
{
"background": "#2e9599",
"background_templates": [
"{{ if gt .Code 0 }}#f1184c{{ end }}"
],
"foreground": "#ffffff",
"properties": {
"always_enabled": true
},
"style": "diamond",
"template": "<#83769c>\ue0b0</> \ue23a ",
"trailing_diamond": "\ue0b4",
"type": "exit"
}
],
"type": "prompt"
},
{
"segments": [
{
"background": "#0077c2",
"foreground": "#ffffff",
"style": "plain",
"template": "<#0077c2,transparent>\ue0b6</> \uf489 {{ .Name }} <transparent,#0077c2>\ue0b2</>",
"type": "shell"
},
{
"background": "#1BD760",
"foreground": "#111111",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"properties": {
"paused_icon": "\uf04c ",
"playing_icon": "\uf04b "
},
"style": "powerline",
"template": " \uf167 {{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} ",
"type": "ytm"
},
{
"background": "#f36943",
"background_templates": [
"{{ if eq \"Full\" .State.String }}#4caf50{{ end }}",
"{{ if eq \"Charging\" .State.String }}#40c4ff{{ end }}",
"{{ if eq \"Discharging\" .State.String }}#ff5722{{ end }}"
],
"foreground": "#ffffff",
"invert_powerline": true,
"powerline_symbol": "\ue0b2",
"properties": {
"charged_icon": "\ue22f ",
"charging_icon": "\ue234 ",
"discharging_icon": "\ue231 "
},
"style": "powerline",
"template": " {{ if not .Error }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ .Error }}\uf295 ",
"type": "battery"
},
{
"background": "#2e9599",
"foreground": "#111111",
"invert_powerline": true,
"leading_diamond": "\ue0b2",
"style": "diamond",
"template": " {{ .CurrentDate | date .Format }} ",
"trailing_diamond": "\ue0b4",
"type": "time"
}
],
"type": "rprompt"
}
],
"console_title_template": "{{ .Shell }} in {{ .Folder }}",
"final_space": true,
"tooltips": [
{
"background": "#fffb38",
"foreground": "#193549",
"foreground_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#ff9248{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}",
"{{ if gt .Ahead 0 }}#f17c37{{ end }}",
"{{ if gt .Behind 0 }}#89d1dc{{ end }}"
],
"leading_diamond": "\ue0b6",
"properties": {
"fetch_status": true,
"fetch_upstream_icon": true
},
"style": "diamond",
"template": " {{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}} \uf692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }} ",
"tips": [
"git",
"g"
],
"trailing_diamond": "\ue0b4",
"type": "git"
}
],
"version": 2
}
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output
Version: 7.59.0
Segments:
ConsoleTitle(true) - 0 ms - pwsh in ~
session(true) - 1 ms - mavad
path(true) - 0 ms - ~
git(false) - 9 ms -
node(false) - 0 ms -
go(false) - 0 ms -
julia(false) - 0 ms -
python(false) - 2 ms -
poshgit(false) - 0 ms -
ruby(false) - 0 ms -
azfunc(false) - 0 ms -
aws(false) - 0 ms -
root(false) - 0 ms -
executiontime(true) - 1 ms - 羽0ms⠀
exit(true) - 2 ms -
shell(true) - 0 ms - pwsh
ytm(false) - 29 ms -
battery(true) - 9 ms - 100
time(true) - 0 ms - 12:14:13
Run duration: 56.4871ms
Cache path: C:\Users\mavad\AppData\Local\oh-my-posh
Logs:
2022/04/05 12:14:13 Flags duration: 0s, args:
2022/04/05 12:14:13 Flags duration: 0s, args:
2022/04/05 12:14:13 debug: Getenv
2022/04/05 12:14:13 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/04/05 12:14:13 Root duration: 0s, args:
2022/04/05 12:14:13 Shell duration: 0s, args:
2022/04/05 12:14:13 ErrorCode duration: 0s, args:
2022/04/05 12:14:13 IsWsl duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: User
mavad
2022/04/05 12:14:13 User duration: 0s, args:
2022/04/05 12:14:13 debug: Host
mavidell
2022/04/05 12:14:13 Host duration: 0s, args:
2022/04/05 12:14:13 GOOS duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Getenv
2022/04/05 12:14:13 Getenv duration: 0s, args: SSH_CONNECTION
2022/04/05 12:14:13 debug: Getenv
2022/04/05 12:14:13 Getenv duration: 0s, args: SSH_CLIENT
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 Flags duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 GOOS duration: 0s, args:
2022/04/05 12:14:13 GOOS duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 GOOS duration: 0s, args:
2022/04/05 12:14:13 IsWsl duration: 0s, args:
2022/04/05 12:14:13 StackCount duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 GOOS duration: 0s, args:
2022/04/05 12:14:13 HasCommand duration: 9.6645ms, args: git.exe
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/04/05 12:14:13 HasParentFilePath duration: 0s, args: .git
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: HasFiles
false
2022/04/05 12:14:13 HasFiles duration: 1.0457ms, args: *.py
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: HasFiles
false
2022/04/05 12:14:13 HasFiles duration: 1.0617ms, args: *.ipynb
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: HasFiles
false
2022/04/05 12:14:13 HasFiles duration: 0s, args: pyproject.toml
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: HasFiles
false
2022/04/05 12:14:13 HasFiles duration: 0s, args: venv.bak
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: HasFiles
false
2022/04/05 12:14:13 HasFiles duration: 0s, args: venv
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 PathSeparator duration: 0s, args:
2022/04/05 12:14:13 debug: HasFiles
false
2022/04/05 12:14:13 HasFiles duration: 0s, args: .venv
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Getenv
2022/04/05 12:14:13 Getenv duration: 0s, args: POSH_GIT_STATUS
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 debug: Getenv
2022/04/05 12:14:13 Getenv duration: 0s, args: AWS_VAULT
2022/04/05 12:14:13 debug: Getenv
default
2022/04/05 12:14:13 Getenv duration: 0s, args: AWS_PROFILE
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 Root duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 ExecutionTime duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 ErrorCode duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 Shell duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 error: HTTPRequest
Get "http://127.0.0.1:9863/query": context deadline exceeded
2022/04/05 12:14:13 HTTPRequest duration: 29.4306ms, args: http://127.0.0.1:9863/query
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 IsWsl duration: 0s, args:
2022/04/05 12:14:13 BatteryInfo duration: 8.0124ms, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Pwd
C:\Users\mavad
2022/04/05 12:14:13 Pwd duration: 0s, args:
2022/04/05 12:14:13 debug: Home
C:\Users\mavad
2022/04/05 12:14:13 TemplateCache duration: 0s, args:
2022/04/05 12:14:13 debug: Getenv
C:\Users\mavad\AppData\Local
2022/04/05 12:14:13 Getenv duration: 0s, args: LOCALAPPDATA
2022/04/05 12:14:13 CachePath duration: 1.0353ms, args:
oh-my-posh fatal error rendering path segment:runtime error: invalid memory address or nil pointer dereference
goroutine 35 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.18.0/x64/src/runtime/debug/stack.go:24 +0x65
oh-my-posh/engine.(*Segment).renderText.func1()
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:326 +0x58
panic({0xe50b40, 0x1906900})
/opt/hostedtoolcache/go/1.18.0/x64/src/runtime/panic.go:838 +0x207
strings.Count({0x0?, 0xc00005a120?}, {0xeea548?, 0xc00002c060?})
/opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:47 +0x50
strings.Replace({0x0, 0xe}, {0xeea548, 0x1}, {0xeea532, 0x1}, 0xffffffffffffffff)
/opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:1003 +0xcf
strings.ReplaceAll(...)
/opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:1037
oh-my-posh/environment.DirMatchesOneOf({0x10202f0, 0xc0000be000}, {0x0?, 0xe?}, {0x1973d40, 0x0, 0x0?})
/home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:724 +0x76
oh-my-posh/engine.(*Segment).cwdExcluded(0xc000316140)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:209 +0xde
oh-my-posh/engine.(*Segment).shouldIncludeFolder(0xc000316140)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:182 +0x36
oh-my-posh/engine.(*Segment).renderText(0xc000316140, {0x10202f0?, 0xc0000be000?})
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:332 +0x7b
oh-my-posh/engine.(*Block).renderSegmentsText.func1(0x0?)
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:88 +0x65
created by oh-my-posh/engine.(*Block).renderSegmentsText
/home/runner/work/oh-my-posh/oh-my-posh/src/engine/block.go:86 +0x98
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 30 (25 by maintainers)
Commits related to this issue
- fix: recover crashing function relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
- fix: recover crashing function relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
- fix: recover crashing function relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
- fix: recover crashing function relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
- fix: sync Pwd() relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
- fix: sync Pwd() relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
- fix: sync Pwd() relates to #2038 — committed to JanDeDobbeleer/oh-my-posh by JanDeDobbeleer 2 years ago
Any update on crashing behaviour? If that’s fixed I’m merging this solution.
@mavaddat @mattcargile @DotNetSparky @devhawk would you mind trying this version? The difference is listed in the related PR, it syncs the
Pwd()function and nothing else. I want to see if the above theory stands.oh-my-posh.zip
Also worth noting that
Write-PoshDebug (PowerShell)will not execute. It freezes or locks up and requires force termination. I had to resort tooh-my-posh debugwhich gave me the above output.I’ve been going through some related errors and got some understanding of the stack trace and variable references in there. We can see
strings.Count((0x0?, Oxe?}, (Oxe4a6087, Oxe?})which implies that the first string has a nonzero length (0xe) but its data pointer is 0x0 which should not happen. It also explains the error as that string is indeed nil (and actually corrupt). It can originate from race conditions, which can be validated withgo test -race ./...but that turns up nothing.So what about the string that’s not what it needs to be? You can see it’s already corrupt when entering
oh-my-posh/environment.dirMatchesOneOf({0x0?, 0x0?}. Let’s have a look at that function:Meaning the
dirprovided is the one that’s causing the issue. That one is directly provided via:In all of the above cases, the provided dir is
env.Pwd(), meaning the following function is returning something incorrect:it could be that in some cases, the value of
env.cwdappears to be set but isn’t just yet and then causes interactions to fail. I’ll try to sync that function so it’s blocking, which shouldn’t impact much.This was written to structure my thoughts and for future reference 😃
I can totally appreciate how you feel–but sometimes, duct-tape is the best temporary solution… 🙃
I added a wrapper around the function so the error is catched, logged and silenced when happening. Not ideal, but better than crashing for the time being. I want to avoid this becoming a mega thread and buy time to come to a structural solution/understanding.
@mavaddat I also noticed this a few times and it also only popped up after I updated to go1.18. The error also originates from go internally, not oh-my-posh logic (made sure to fix that in the previous report). Does it still happen after restarting your terminal ?
I have not seen any crashes since using your test version, so you have my vote 😃
@mavaddat , that appears to be a different issue. Do you have a link in your home directory to a UNC path? That behavior is the same when you
cdinto a UNC directory when on the build on this Issue.Oops, thanks @mattcargile . I routinely run
winget upgrade --allwhich obviously erases the customoh-my-posh.exebuild. D’oh.@mattcargile I’ll rebase as it should since that wasn’t changed. @mavaddatsure you’re using the provided build?
@JanDeDobbeleer - I’ll continue testing it over the weekend, but just wanted to let you know that, despite using the console a lot for two hours now, no errors so far!
Thanks! The fix has cleared it up for me. I don’t even notice
errorin any of the segments when runningGet-PoshThemeslike I did before.So my assumption of it being caused by concurrency is wrong. Hmm. I have no clue just yet, haven’t seen this on macOS either, could be an issue in the Windows version of golang. If there’s a clear reproducible case that would help but it still seems random.
I did some digging and there’s nothing that really sparks my attention unless I’m missing something obvious (it can happen, I’m only human). What does happen is that that part of the code is executed in a goroutine to run all segment logic in parallel. It can be that
strings.ReplaceAllhas a problem with that. I have a fix ready that will run this code synchronous, so it should no longer be executed in parallel.