JanDeDobbeleer / oh-my-posh

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

Seg fault error at `runtime/debug/stack.go` after update #2038

Closed mavaddat closed 2 years ago

mavaddat commented 2 years ago

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
mavaddat commented 2 years ago

Also worth noting that Write-PoshDebug (PowerShell) will not execute. It freezes or locks up and requires force termination. I had to resort to oh-my-posh debug which gave me the above output.

JanDeDobbeleer commented 2 years ago

@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 ?

JanDeDobbeleer commented 2 years ago

It seems to fail on a line inside go itself, and I'm not quite sure I understand how/why

Codepath

if len(substr) == 1 {
    return bytealg.CountString(s, substr[0])
}

That almost implies that bytealg is nil here. I know for a fact that the error started to appear when I made the DirMatchesOneOf part of environment. Before that we never had any issue there. Maybe I can try to move it back out, but that doesn't come even close to explain what's really going on.

JanDeDobbeleer commented 2 years ago

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.ReplaceAll has a problem with that. I have a fix ready that will run this code synchronous, so it should no longer be executed in parallel.

mattcargile commented 2 years ago

I keep getting this intermittently. It can happen when I Exit-PSSession or Get-ChildItem. I can't repro it at all and it seems random. Though it does seem to occur more often after I "jump" to another directory with ZLocation module and then run ls. Write-PoshDebug does lock up on new sessions. Here is my error.

oh-my-posh fatal error rendering session segment:runtime error: invalid memory address or nil pointer dereference

goroutine 5 [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({0xdb0bc0, 0x1866900})
        /opt/hostedtoolcache/go/1.18.0/x64/src/runtime/panic.go:838 +0x207
strings.Count({0x0?, 0xe?}, {0xe4a608?, 0xe?})
        /opt/hostedtoolcache/go/1.18.0/x64/src/strings/strings.go:47 +0x50
strings.Replace({0x0, 0x53}, {0xe4a608, 0x1}, {0xe4a5f2, 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({0x0?, 0x0?}, {0xc0005320a0, 0x10}, {0xe4d6ad, 0x7}, {0x18d3d40, 0x0, 0xc000284000?})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:737 +0x72
oh-my-posh/environment.(*ShellEnvironment).DirMatchesOneOf(0xc000284000, {0x0, 0x53}, {0x18d3d40, 0x0, 0x0})
        /home/runner/work/oh-my-posh/oh-my-posh/src/environment/shell.go:733 +0x125
oh-my-posh/engine.(*Segment).cwdExcluded(0xc0002d0000)
        /home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:209 +0xe2
oh-my-posh/engine.(*Segment).shouldIncludeFolder(0xc0002d0000)
        /home/runner/work/oh-my-posh/oh-my-posh/src/engine/segment.go:182 +0x36
oh-my-posh/engine.(*Segment).renderText(0xc0002d0000, {0xf80350?, 0xc000284000?})
        /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

I'm on 7.59.4 using pwsh.exe Version 7.2.2.

EDIT: I did restart my Windows Terminal. I'll report back if it happens again.

EDIT 2: I'm on Windows 20H2 Version 19042.1586.

EDIT 3: Had another segfault. Of note, the error appears in the ending left segment on the default jandedobbeleer theme.

image

JanDeDobbeleer commented 2 years ago

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.

devhawk commented 2 years ago

I'm getting this periodically after upgrading to 7.59.4. Like @mattcargile, seems random and I can't reliably repro.

mattcargile commented 2 years ago

I can more "reliably" produce it running Get-PoshThemes. Let me run procmon trace on it and see what I can find.

EDIT: I can't really easily tell. Maybe it is something with concurrency.

EDIT 2: ~From the procmon trace, I can see one event that stands out. It is a call from oh-my-posh.exe to CreateFileA in KernelBase.dll. The path to the file is C:\WINDOWS\system32\dc9e6cd55143cfaab06d4304fb2c2706ebf3a1194129208d06a3b97811b65cf0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA. procmon gives a result of NAME INVALID. Between two different traces the pattern is this Event with all the AAAAs at the end. Not sure what this means.~ Nevermind.

EDIT 3: I tried adding an Exclusion for Windows Security with Add-MpPreference and that didn't work. Get-PoshThemes is much much faster though!

JanDeDobbeleer commented 2 years ago

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.

mattcargile commented 2 years ago

Thanks! The fix has cleared it up for me. I don't even notice error in any of the segments when running Get-PoshThemes like I did before.

DotNetSparky commented 2 years ago

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.

I can totally appreciate how you feel--but sometimes, duct-tape is the best temporary solution... 🙃

JanDeDobbeleer commented 2 years ago

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 with go test -race ./... but that turns up nothing.

?       oh-my-posh  [no test files]
?       oh-my-posh/cli  [no test files]
ok      oh-my-posh/color    (cached)
ok      oh-my-posh/console  (cached)
?       oh-my-posh/constants    [no test files]
ok      oh-my-posh/engine   2.830s
ok      oh-my-posh/environment  (cached)
?       oh-my-posh/mock [no test files]
ok      oh-my-posh/properties   (cached)
?       oh-my-posh/regex    [no test files]
ok      oh-my-posh/segments (cached)
ok      oh-my-posh/shell    (cached)
ok      oh-my-posh/template (cached)

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:

func dirMatchesOneOf(dir, home, goos string, regexes []string) bool

Meaning the dir provided is the one that's causing the issue. That one is directly provided via:

func (env *ShellEnvironment) DirMatchesOneOf(dir string, regexes []string) (match bool)

In all of the above cases, the provided dir is env.Pwd(), meaning the following function is returning something incorrect:

func (env *ShellEnvironment) Pwd() string {
    defer env.trace(time.Now(), "Pwd")
    defer func() {
        env.log(Debug, "Pwd", env.cwd)
    }()
    if env.cwd != "" {
        return env.cwd
    }
    correctPath := func(pwd string) string {
        // on Windows, and being case sensitive and not consistent and all, this gives silly issues
        driveLetter := regex.GetCompiledRegex(`^[a-z]:`)
        return driveLetter.ReplaceAllStringFunc(pwd, strings.ToUpper)
    }
    if env.CmdFlags != nil && env.CmdFlags.PWD != "" {
        env.cwd = correctPath(env.CmdFlags.PWD)
        return env.cwd
    }
    dir, err := os.Getwd()
    if err != nil {
        env.log(Error, "Pwd", err.Error())
        return ""
    }
    env.cwd = correctPath(dir)
    return env.cwd
}

it could be that in some cases, the value of env.cwd appears 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 :-)

JanDeDobbeleer commented 2 years ago

@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

mavaddat commented 2 years ago

@mavaddat @mattcargile @DotNetSparky @devhawk would you mind trying this version?

I have copied oh-my-posh.exe into my $env:LOCALAPPDATA\Programs\oh-my-posh\bin\ overwriting the oh-my-posh.exe and I reloaded the shell. What should I try to verify?

DotNetSparky commented 2 years ago

So far (just a couple minutes of testing), and no errors. But it seemed intermittent before--I'll keep using it and will let you know if it pukes (highly technical term for a seg-fault?)

JanDeDobbeleer commented 2 years ago

@mavaddat use it for a while. I want to see if this fixes the issue as well. As that's the clean fix (if confirmed).

Thanks @DotNetSparky

DotNetSparky commented 2 years ago

@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!

mattcargile commented 2 years ago

Run Get-PoshThemes and look for the error in all the output.

mavaddat commented 2 years ago

After using it for a bit, I found the following command seems to relaibly crash oh-my-posh.exe:

Get-ChildItem -Path . -Depth 0 -Directory | Sort-Object -Property CreationTimeUtc -Descending  | Select-Object -First 1

However, I am not sure this is related to the above symptoms (the seg fault reported in the op). I believe that the oh-my-posh.exe has a hard time digesting the Microsoft.PowerShell.Core\FileSystem::[…] path, because if I do Set-Location $env:USERPROFILE (i.e., cd ~), then the rich shell prompt is visible again.

mattcargile commented 2 years ago

I'm trying the new build and haven't received any errors yet. I tried @mavaddat's repro above and couldn't recreate the error. On another note, the new build doesn't support Registry paths or UNC paths. Get-PoshThemes doesn't fail anymore though.

JanDeDobbeleer commented 2 years ago

@mattcargile I'll rebase as it should since that wasn't changed. @mavaddatsure you're using the provided build?

mavaddat commented 2 years ago

@mavaddat sure you're using the provided build?

Yes, oh-my-posh.exe --version returns 7.60.0.

@mattcargile @JanDeDobbeleer I am sorry, I missed the final piped part of the error producing code Set-Location.

Get-ChildItem -Path . -Depth 0 -Directory | Sort-Object -Property CreationTimeUtc -Descending  | Select-Object -First 1 | Set-Location
mattcargile commented 2 years ago

The oh-my-posh.exe has to be copied and pasted. 7.60 doesn't include the fix as far as I know. I had to switch to that version recently today because the build in this Issue had issues with UNC.

mavaddat commented 2 years ago

oh-my-posh.exe debug | Set-Clipboard gives:

Long output of debug ``` Version: 7.60.0 Segments: ConsoleTitle(true) - 0 ms - pwsh in xpdf-tools session(true) - 0 ms -  mavad  path(true) - 1 ms -   xpdf-tools  git(false) - 9 ms - node(false) - 2 ms - go(false) - 0 ms - julia(false) - 0 ms - python(false) - 1 ms - poshgit(false) - 0 ms - ruby(false) - 0 ms - azfunc(false) - 0 ms - aws(false) - 0 ms - root(false) - 1 ms - executiontime(true) - 1 ms -  羽0ms⠀ exit(true) - 0 ms -    shell(true) - 1 ms -   pwsh  ytm(false) - 24 ms - battery(true) - 10 ms -   100  time(true) - 0 ms -  15:19:10  Run duration: 54.0692ms Cache path: C:\Users\mavad\AppData\Local\oh-my-posh Logs: 2022/04/11 15:19:10 Flags duration: 0s, args: 2022/04/11 15:19:10 Flags duration: 0s, args: 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: OMP_CACHE_DISABLED 2022/04/11 15:19:10 Root duration: 0s, args: 2022/04/11 15:19:10 Shell duration: 0s, args: 2022/04/11 15:19:10 ErrorCode duration: 0s, args: 2022/04/11 15:19:10 IsWsl duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: User mavad 2022/04/11 15:19:10 User duration: 0s, args: 2022/04/11 15:19:10 debug: Host mavidell 2022/04/11 15:19:10 Host duration: 0s, args: 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: SSH_CONNECTION 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: SSH_CLIENT 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 Flags duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 IsWsl duration: 0s, args: 2022/04/11 15:19:10 StackCount duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 HasCommand duration: 9.574ms, args: git.exe 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 error: HasParentFilePath CreateFile C:\.git: The system cannot find the file specified. 2022/04/11 15:19:10 HasParentFilePath duration: 0s, args: .git 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 1.0099ms, args: *.js 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: *.ts 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: package.json 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: .nvmrc 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: pnpm-workspace.yaml 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: .pnpmfile.cjs 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 1.1104ms, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 1.1104ms, args: .npmrc 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: .vue 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: *.go 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: go.mod 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: *.jl 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: *.py 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: *.ipynb 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 1.0105ms, args: pyproject.toml 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: venv.bak 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: venv 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: .venv 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: POSH_GIT_STATUS 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: *.rb 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: Rakefile 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: Gemfile 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: host.json 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: local.settings.json 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 PathSeparator duration: 0s, args: 2022/04/11 15:19:10 debug: HasFiles false 2022/04/11 15:19:10 HasFiles duration: 0s, args: function.json 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: AWS_VAULT 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: AWS_PROFILE 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: AWS_REGION 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: AWS_DEFAULT_REGION 2022/04/11 15:19:10 debug: Getenv 2022/04/11 15:19:10 Getenv duration: 0s, args: AWS_CONFIG_FILE 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 debug: FileContent [default] region = ca-central-1 output = json cli_pager = 2022/04/11 15:19:10 FileContent duration: 0s, args: C:\Users\mavad/.aws/config 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 Root duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 ExecutionTime duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 ErrorCode duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 Shell duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 error: HTTPRequest Get "http://127.0.0.1:9863/query": context deadline exceeded 2022/04/11 15:19:10 HTTPRequest duration: 24.3439ms, args: http://127.0.0.1:9863/query 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 IsWsl duration: 0s, args: 2022/04/11 15:19:10 BatteryInfo duration: 8.5868ms, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Pwd C:\Users\mavad\xpdf-tools 2022/04/11 15:19:10 Pwd duration: 0s, args: 2022/04/11 15:19:10 debug: Home C:\Users\mavad 2022/04/11 15:19:10 GOOS duration: 0s, args: 2022/04/11 15:19:10 TemplateCache duration: 0s, args: 2022/04/11 15:19:10 debug: Getenv C:\Users\mavad\AppData\Local 2022/04/11 15:19:10 Getenv duration: 0s, args: LOCALAPPDATA 2022/04/11 15:19:10 CachePath duration: 0s, args: ```
mavaddat commented 2 years ago

The oh-my-posh.exe has to be copied and pasted. 7.60 doesn't include the fix as far as I know.

Oops, thanks @mattcargile . I routinely run winget upgrade --all which obviously erases the custom oh-my-posh.exe build. D'oh.

mavaddat commented 2 years ago

That being said, with the custom version, I am able to repro the Set-Location weirdness.

Get-ChildItem -Path . -Depth 0 -Directory | Sort-Object -Property CreationTimeUtc -Descending  | Select-Object -First 1 | Set-Location

image

cd ~

image

mattcargile commented 2 years ago

I routinely run winget upgrade --all which obviously erases the custom oh-my-posh.exe build. D'oh.

I see. I've always been afraid to run winget for everything. Sorry a bit off topic but do you get errors on certain upgrades for dupes?

mattcargile commented 2 years ago

@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 cd into a UNC directory when on the build on this Issue.

JanDeDobbeleer commented 2 years ago

Any update on crashing behaviour? If that's fixed I'm merging this solution.

DotNetSparky commented 2 years ago

I have not seen any crashes since using your test version, so you have my vote :)

github-actions[bot] commented 7 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.