JanDeDobbeleer / oh-my-posh

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

Strange issue on Ubuntu 20.04/Bash 5.0.17 - Path segment not updated #4788

Closed mdove closed 7 months ago

mdove commented 7 months ago

Code of Conduct

What happened?

The line 'eval "$(oh-my-posh init bash --config ~/.mdove.omp.json)"' exists as the last line in my .bashrc. .bash_profile is a single line " if [ -f ~/.bashrc ]; then . ~/.bashrc; fi".

I create a new login shell on this Linux instance (via SSH), and everything "appears" as expected. My oh-my-posh profile is being read and displays my configuration colors/segments correctly. However, as soon as I "cd" to any other directory, the path segment doesn't update, and remains a "~".

BUT, if I simply re-run 'eval "$(oh-my-posh init bash --config ~/.mdove.omp.json)"' from the command line, it "resolves" itself, and now displays the directory I changed to, and works as I move around going forward.

The same set of .bash_profile, .bashrc work under MacOS (multiple versions) with bash 5.2 variants as well as Debian systems (variety of raspi's) with bash 5.2 variants without this issue. Is this an issue with the 5.0 bash on these particular (AWS) instances?

In the debug log below, you'll notice I had switched to a directory named "Development", however the prompt which gets displayed to me is "~".

Theme

Personal theme based originally on Jan's

What OS are you seeing the problem on?

Linux

Which shell are you using?

bash

Log output

Version: 19.18.1

Shell: bash (5.0.17(1)-release)

Prompt:

󰢋 ubuntu@asset-tracker ~/Development  

Segments:

ConsoleTitle(true)                        -   0 ms
Session(true)                             -   0 ms
Path(true)                                -   3 ms
Git(false)                                -   1 ms
Python(false)                             -   5 ms
Aws(false)                                -   1 ms
Docker(false)                             -   2 ms
Root(false)                               -   0 ms
Upgrade(false)                            -   1 ms
Status(true)                              -   3 ms
Command(false)                            -   0 ms

Run duration: 27.815082ms

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

Config path: /home/ubuntu/.mdove.omp.json

Logs:

[DEBUG] 16:11:06.099 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.099 shell.go:Getenv(TERM_PROGRAM) - 62.852µs
[DEBUG] 16:11:06.099 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.099 shell.go:Getenv(OMP_CACHE_DIR) - 5.27µs
[DEBUG] 16:11:06.099 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.099 shell.go:Getenv(XDG_CACHE_HOME) - 4.001µs
[TRACE] 16:11:06.099 shell_unix.go:CachePath() - 30.801µs
[DEBUG] 16:11:06.100 shell.go:Getenv:325 → /home/ubuntu/.mdove.omp.json
[TRACE] 16:11:06.100 shell.go:Getenv(POSH_THEME) - 12.82µs
[DEBUG] 16:11:06.100 shell_unix.go:Platform:87 → ubuntu
[TRACE] 16:11:06.100 shell.go:resolveConfigPath() - 43.741µs
[TRACE] 16:11:06.100 shell.go:Init() - 362.713µs
[TRACE] 16:11:06.100 shell.go:Flags() - 70ns
[TRACE] 16:11:06.101 config.go:loadConfig() - 1.06793ms
[TRACE] 16:11:06.101 shell.go:Flags() - 60ns
[DEBUG] 16:11:06.101 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.101 shell.go:Getenv(OMP_CACHE_DISABLED) - 12.3µs
[DEBUG] 16:11:06.101 shell.go:Shell:593 → no shell name provided in flags, trying to detect it
[DEBUG] 16:11:06.120 shell.go:Shell:601 → process name: bash
[TRACE] 16:11:06.120 shell.go:Shell() - 18.964707ms
[DEBUG] 16:11:06.120 shell.go:Getenv:325 → 5.0.17(1)-release
[TRACE] 16:11:06.120 shell.go:Getenv(POSH_SHELL_VERSION) - 5.38µs
[DEBUG] 16:11:06.120 debug.go:PrintDebug:22 → Segment: Title
[DEBUG] 16:11:06.120 text.go:Render:70 → Rendering template: {{ .Shell }} in {{ .Folder }}
[TRACE] 16:11:06.120 shell_unix.go:Root() - 620ns
[TRACE] 16:11:06.120 shell.go:Shell() - 120ns
[TRACE] 16:11:06.120 shell.go:StatusCodes() - 90ns
[DEBUG] 16:11:06.120 shell_unix.go:IsWsl:35 → false
[TRACE] 16:11:06.120 shell_unix.go:IsWsl() - 11.64µs
[DEBUG] 16:11:06.120 shell.go:TemplateCache:774 → environment: [SHELL=/bin/bash PIPENV_VENV_IN_PROJECT=true PIPENV_VERBOSITY=-1 POSH_PID=2791347 ITERM2_SQUELCH_MARK= HISTTIMEFORMAT=%a %T  ITERM_PREV_PS1=\[\]\[\]\[\]\[\]\[\]󰢋 ubuntu@asset-tracker\[\]\[\]\[\]\[\]\[\]\[\]\[\] ~ \[\]\[\]\[\]\[\]\[\]\[\]\[\]\[\] \[\]\[\]\[\]\[\] \[\] EDITOR=code ITERM_ORIG_PS1=\[\]\[\]\[\]\[\]󰢋 ubuntu@asset-tracker\[\]\[\]\[\]\[\]\[\]\[\]\[\] ~ \[\]\[\]\[\]\[\]\[\]\[\]\[\]\[\] \[\]\[\]\[\]\[\]  PWD=/home/ubuntu/Development LOGNAME=ubuntu XDG_SESSION_TYPE=tty MOTD_SHOWN=pam HOME=/home/ubuntu LANG=C.UTF-8 POSH_SHELL_VERSION=5.0.17(1)-release CONDA_PROMPT_MODIFIER=false LC_TERMINAL=iTerm2 SSH_CONNECTION=98.45.4.46 55883 10.2.3.52 22 XDG_SESSION_CLASS=user TERM=xterm-256color HOST=asset-tracker USER=ubuntu LC_TERMINAL_VERSION=3.4.23 SHLVL=1 XDG_SESSION_ID=5803 POSH_THEME=/home/ubuntu/.mdove.omp.json XDG_RUNTIME_DIR=/run/user/1000 PS1=\[\]\[\]\[\]\[\]󰢋 ubuntu@asset-tracker\[\]\[\]\[\]\[\]\[\]\[\]\[\] ~ \[\]\[\]\[\]\[\]\[\]\[\]\[\]\[\] \[\]\[\]\[\]\[\]  SSH_CLIENT=98.45.4.46 55883 22 XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop PATH=/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus SSH_TTY=/dev/pts/28 POWERLINE_COMMAND=oh-my-posh OLDPWD=/home/ubuntu _=/usr/local/bin/oh-my-posh]
[TRACE] 16:11:06.120 shell.go:GOOS() - 80ns
[DEBUG] 16:11:06.120 shell.go:Pwd:355 → /home/ubuntu/Development
[TRACE] 16:11:06.120 shell.go:Pwd() - 26.961µs
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 50ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 50ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 50ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 50ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 50ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 50ns
[DEBUG] 16:11:06.120 shell.go:User:493 → ubuntu
[TRACE] 16:11:06.120 shell.go:User() - 4.71µs
[DEBUG] 16:11:06.120 shell.go:Host:505 → asset-tracker
[TRACE] 16:11:06.120 shell.go:Host() - 6.53µs
[TRACE] 16:11:06.120 shell.go:GOOS() - 60ns
[DEBUG] 16:11:06.120 shell_unix.go:Platform:87 → ubuntu
[DEBUG] 16:11:06.120 shell.go:Getenv:325 → 1
[TRACE] 16:11:06.120 shell.go:Getenv(SHLVL) - 4.52µs
[TRACE] 16:11:06.120 shell.go:TemplateCache() - 213.948µs
[DEBUG] 16:11:06.120 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.120 shell.go:Getenv(POSH_CURSOR_LINE) - 4.16µs
[DEBUG] 16:11:06.120 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.120 shell.go:Getenv(POSH_CURSOR_COLUMN) - 10.451µs
[TRACE] 16:11:06.120 shell.go:Flags() - 70ns
[TRACE] 16:11:06.120 shell.go:Flags() - 60ns
[TRACE] 16:11:06.120 shell.go:Shell() - 60ns
[TRACE] 16:11:06.120 shell.go:Shell() - 60ns
[TRACE] 16:11:06.120 shell.go:Flags() - 70ns
[TRACE] 16:11:06.120 shell.go:Flags() - 230ns
[DEBUG] 16:11:06.120 properties.go:GetString:28 → {{ .Code }}
[TRACE] 16:11:06.120 shell.go:Pwd() - 170ns
[TRACE] 16:11:06.120 shell.go:GOOS() - 100ns
[DEBUG] 16:11:06.120 segment.go:SetEnabled:529 → Segment: Status
[TRACE] 16:11:06.121 shell.go:StatusCodes() - 90ns
[DEBUG] 16:11:06.121 text.go:Render:70 → Rendering template: {{ .Code }}
[DEBUG] 16:11:06.121 properties.go:GetString:28 → environment
[TRACE] 16:11:06.121 shell.go:Pwd() - 180ns
[TRACE] 16:11:06.121 shell.go:GOOS() - 70ns
[DEBUG] 16:11:06.121 segment.go:SetEnabled:529 → Segment: Python
[DEBUG] 16:11:06.121 properties.go:GetStringArray:52 → extensions: [*.py *.ipynb pyproject.toml venv.bak]
[TRACE] 16:11:06.121 shell.go:Flags() - 140ns
[DEBUG] 16:11:06.121 properties.go:GetStringArray:52 → folders: [.venv venv virtualenv venv-win pyenv-win]
[TRACE] 16:11:06.121 shell.go:Flags() - 100ns
[DEBUG] 16:11:06.121 properties.go:GetBool:22 → home_enabled: false
[TRACE] 16:11:06.121 shell.go:Pwd() - 130ns
[TRACE] 16:11:06.121 shell.go:Pwd() - 170ns
[DEBUG] 16:11:06.121 properties.go:GetBool:22 → fetch_virtual_env: true
[TRACE] 16:11:06.121 shell.go:GOOS() - 80ns
[DEBUG] 16:11:06.121 segment.go:SetEnabled:529 → Segment: Path
[TRACE] 16:11:06.121 shell.go:Pwd() - 120ns
[TRACE] 16:11:06.121 shell.go:Pwd() - 150ns
[TRACE] 16:11:06.121 shell.go:GOOS() - 80ns
[TRACE] 16:11:06.121 shell.go:Shell() - 120ns
[TRACE] 16:11:06.121 shell.go:Shell() - 60ns
[ERROR] 16:11:06.121 shell.go:CommandPath:549 → exec: "python": executable file not found in $PATH
[DEBUG] 16:11:06.121 segment.go:SetEnabled:529 → Segment: Session
[TRACE] 16:11:06.121 shell.go:CommandPath(python) - 78.933µs
[DEBUG] 16:11:06.121 shell.go:Getenv:325 → 98.45.4.46 55883 10.2.3.52 22
[DEBUG] 16:11:06.121 properties.go:GetBool:22 → mapped_locations_enabled: true
[TRACE] 16:11:06.121 shell.go:Getenv(SSH_CONNECTION) - 11.481µs
[DEBUG] 16:11:06.121 properties.go:GetString:28 → 
[TRACE] 16:11:06.121 shell.go:TemplateCache() - 230ns
[DEBUG] 16:11:06.121 properties.go:GetString:28 → 
[TRACE] 16:11:06.121 shell.go:GOOS() - 70ns
[DEBUG] 16:11:06.121 properties.go:GetString:28 → ~
[DEBUG] 16:11:06.121 shell.go:CommandPath:545 → /usr/bin/python3
[TRACE] 16:11:06.121 shell.go:Flags() - 160ns
[TRACE] 16:11:06.121 shell.go:CommandPath(python3) - 40.072µs
[DEBUG] 16:11:06.121 properties.go:GetKeyValueMap:46 → mapped_locations: map[]
[TRACE] 16:11:06.121 shell.go:PathSeparator() - 100ns
[TRACE] 16:11:06.121 shell.go:Pwd() - 150ns
[TRACE] 16:11:06.121 shell.go:GOOS() - 80ns
[TRACE] 16:11:06.121 shell.go:GOOS() - 100ns
[TRACE] 16:11:06.121 shell.go:GOOS() - 90ns
[DEBUG] 16:11:06.121 segment.go:SetEnabled:529 → Segment: Git
[DEBUG] 16:11:06.121 shell_unix.go:IsWsl:35 → false
[TRACE] 16:11:06.121 shell_unix.go:IsWsl() - 7.36µs
[TRACE] 16:11:06.121 shell_unix.go:IsWsl2() - 13.321µs
[TRACE] 16:11:06.121 shell.go:GOOS() - 60ns
[DEBUG] 16:11:06.121 shell.go:CommandPath:545 → /usr/bin/git
[TRACE] 16:11:06.121 shell.go:CommandPath(git) - 51.062µs
[TRACE] 16:11:06.121 shell.go:HasCommand(git) - 57.792µs
[TRACE] 16:11:06.121 shell.go:Pwd() - 130ns
[TRACE] 16:11:06.121 shell.go:Flags() - 170ns
[ERROR] 16:11:06.121 shell.go:HasParentFilePath:689 → stat .git: no such file or directory
[TRACE] 16:11:06.121 shell.go:Pwd() - 130ns
[TRACE] 16:11:06.121 shell.go:HasParentFilePath(.git) - 42.342µs
[TRACE] 16:11:06.121 shell.go:Flags() - 830ns
[TRACE] 16:11:06.122 shell.go:Pwd() - 180ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 110ns
[DEBUG] 16:11:06.122 segment.go:SetEnabled:529 → Segment: Root
[TRACE] 16:11:06.122 shell_unix.go:Root() - 440ns
[TRACE] 16:11:06.122 shell.go:Pwd() - 130ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 80ns
[DEBUG] 16:11:06.122 segment.go:SetEnabled:529 → Segment: Upgrade
[TRACE] 16:11:06.122 shell.go:GOOS() - 180ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.122 shell.go:PathSeparator() - 90ns
[TRACE] 16:11:06.122 shell.go:PathSeparator() - 70ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.122 shell.go:PathSeparator() - 70ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.122 shell.go:PathSeparator() - 80ns
[TRACE] 16:11:06.122 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.123 shell.go:GOOS() - 70ns
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 60ns
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 80ns
[TRACE] 16:11:06.123 shell.go:FileContent(/home/ubuntu/.aws/config) - 67.213µs
[DEBUG] 16:11:06.123 properties.go:GetString:28 → agnoster_short
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 120ns
[DEBUG] 16:11:06.123 properties.go:GetInt:40 → max_depth: 2
[DEBUG] 16:11:06.123 properties.go:GetString:28 → ..
[DEBUG] 16:11:06.123 properties.go:GetBool:22 → hide_root_location: false
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 140ns
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 70ns
[DEBUG] 16:11:06.123 properties.go:GetStringArray:52 → cycle: []
[DEBUG] 16:11:06.123 properties.go:GetString:28 → NO DATA
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 80ns
[DEBUG] 16:11:06.123 properties.go:GetString:28 → /
[DEBUG] 16:11:06.123 properties.go:GetBool:22 → cycle_folder_separator: false
[DEBUG] 16:11:06.123 properties.go:GetString:28 → %s
[DEBUG] 16:11:06.123 properties.go:GetString:28 → %s
[TRACE] 16:11:06.123 shell.go:PathSeparator() - 190ns
[TRACE] 16:11:06.123 shell.go:Pwd() - 220ns
[DEBUG] 16:11:06.123 shell_unix.go:IsWsl:35 → false
[TRACE] 16:11:06.123 shell_unix.go:IsWsl() - 13.58µs
[ERROR] 16:11:06.121 shell.go:FileContent:463 → open /home/ubuntu/.docker/config.json: no such file or directory
[TRACE] 16:11:06.124 shell.go:StackCount() - 100ns
[TRACE] 16:11:06.124 shell_unix.go:DirIsWritable(/home/ubuntu/Development) - 11.6µs
[TRACE] 16:11:06.124 shell.go:TemplateCache() - 350ns
[TRACE] 16:11:06.124 shell.go:TemplateCache() - 420ns
[DEBUG] 16:11:06.124 properties.go:GetBool:22 → always_enabled: true
[TRACE] 16:11:06.124 shell.go:TemplateCache() - 130ns
[DEBUG] 16:11:06.126 shell.go:HasFilesInDir:408 → false
[TRACE] 16:11:06.126 shell.go:HasFilesInDir(pyvenv.cfg) - 4.825613ms
[DEBUG] 16:11:06.126 shell.go:HasFilesInDir:408 → false
[TRACE] 16:11:06.126 shell.go:HasFilesInDir(pyvenv.cfg) - 49.752µs
[DEBUG] 16:11:06.126 properties.go:GetBool:22 → folder_name_fallback: true
[DEBUG] 16:11:06.126 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.126 shell.go:Getenv(VIRTUAL_ENV) - 5.07µs
[DEBUG] 16:11:06.126 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.126 shell.go:Getenv(CONDA_ENV_PATH) - 3.86µs
[DEBUG] 16:11:06.126 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.126 shell.go:Getenv(CONDA_DEFAULT_ENV) - 3.61µs
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: <#193549></> 
[TRACE] 16:11:06.126 shell.go:Shell() - 170ns
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template:  {{ .Path }}
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: {{ if .SSHSession }}󰢋 {{ end }}{{ if eq .Env.USER "mdove" }}{{ .Env.HOST }}{{ else }}{{ .UserName }}@{{ .Env.HOST }}{{ end }}
[TRACE] 16:11:06.126 shell.go:TemplateCache() - 280ns
[TRACE] 16:11:06.126 shell.go:Shell() - 120ns
[TRACE] 16:11:06.126 shell.go:TemplateCache() - 260ns
[TRACE] 16:11:06.126 shell.go:Shell() - 150ns
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: {{ if .SSHSession }}#737300{{end}}
[TRACE] 16:11:06.126 shell.go:TemplateCache() - 180ns
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: diamond
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: powerline
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: powerline
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: powerline
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: powerline
[DEBUG] 16:11:06.126 text.go:Render:70 → Rendering template: powerline
[DEBUG] 16:11:06.127 text.go:Render:70 → Rendering template: powerline
[DEBUG] 16:11:06.127 text.go:Render:70 → Rendering template: plain
[DEBUG] 16:11:06.127 text.go:Render:70 → Rendering template: {{ if .Error }}#e91e63{{ end }}
[TRACE] 16:11:06.127 shell.go:TemplateCache() - 230ns
[DEBUG] 16:11:06.127 text.go:Render:70 → Rendering template: diamond
[TRACE] 16:11:06.127 shell.go:Shell() - 130ns
[TRACE] 16:11:06.127 shell.go:Shell() - 50ns
[TRACE] 16:11:06.127 shell.go:Shell() - 60ns
[TRACE] 16:11:06.127 shell.go:Shell() - 50ns
[DEBUG] 16:11:06.127 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.127 shell.go:Getenv(OMP_CACHE_DISABLED) - 4.64µs
[TRACE] 16:11:06.127 shell.go:Flags() - 70ns
[TRACE] 16:11:06.127 shell.go:Flags() - 90ns
[TRACE] 16:11:06.127 shell.go:Pwd() - 140ns
[TRACE] 16:11:06.127 shell.go:GOOS() - 80ns
[TRACE] 16:11:06.127 shell.go:Pwd() - 120ns
[TRACE] 16:11:06.127 shell.go:GOOS() - 60ns
[TRACE] 16:11:06.127 shell.go:Shell() - 110ns
[TRACE] 16:11:06.127 shell.go:Shell() - 70ns
[TRACE] 16:11:06.127 shell.go:Flags() - 60ns
[TRACE] 16:11:06.127 shell.go:Shell() - 60ns
[TRACE] 16:11:06.127 shell.go:Shell() - 60ns
[DEBUG] 16:11:06.127 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.127 shell.go:Getenv(OMP_CACHE_DIR) - 5.36µs
[DEBUG] 16:11:06.127 shell.go:Getenv:325 → NO DATA
[TRACE] 16:11:06.127 shell.go:Getenv(XDG_CACHE_HOME) - 3.59µs
[TRACE] 16:11:06.127 shell_unix.go:CachePath() - 30.851µs
[TRACE] 16:11:06.127 shell.go:Flags() - 60ns
JanDeDobbeleer commented 7 months ago

@mdove this is an issue with the bash environment and settings. See here for a similar issue.