Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration Ignored When Upgrade Check Fails #6071

Open
1 task done
MarwenDallel opened this issue Jan 3, 2025 · 0 comments
Open
1 task done

Configuration Ignored When Upgrade Check Fails #6071

MarwenDallel opened this issue Jan 3, 2025 · 0 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@MarwenDallel
Copy link

MarwenDallel commented Jan 3, 2025

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

Description

When the upgrade check fails (due to a network issue or VPN), oh-my-posh retries the check every time a terminal is opened, ignoring configuration options intended to limit these checks.

For instance:

  • Upgrade checks are performed despite auto_upgrade being set to false and interval being specified.
  • The only upgrade-related configuration that appears to be respected is the source parameter.
  • Documentation for oh-my-posh seems outdated, as it doesn't mention newer options such as disable_notice and auto_upgrade.

A VPN (e.g., ExpressVPN) is one scenario that can cause these failures consistently. In fact, I am able to resolve the domain name and get a response from the version URLs that omp uses with cURL but omp fails for some reason. I even tried to isolate the download functionality and compile a simple program in Go that relies on net/http to test and it worked just fine.

check_failure_vpn

Steps to Reproduce

  1. Simulate conditions where the upgrade check might fail.
  2. Set any configuration option related to upgrades other than source (auto, notice, etc.).
  3. Observe:
    • Long delays occur due to timeouts while attempting to fetch the version from the CDN.
    • Upgrade checks are triggered every time the terminal is opened, regardless of the configuration settings.

Expected Behavior

  1. Upgrade checks should respect the interval configuration, even if previous fetch attempts failed.
  2. Options like auto_upgrade: false and disable_notice: true should be respected.

Relevant Code Reference

The issue is most likely due to the lack of caching when the upgrade check fails, leading to the interval setting being ignored.

cfg := &upgrade.Config{
Source: upgrade.Source(source),
Interval: cache.Duration(duration),
}
latest, err := cfg.Latest()
if err != nil {
return nil, err
}
cacheData := &UpgradeCache{
Latest: latest,
Current: current,
}

Theme

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "auto_upgrade": false,
  "disable_notice": false,
  "upgrade": {
    "notice": false,
    "auto": false,
    "interval": "168h",
    "source": "cdn"
  },
  "version": 3
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 24.18.0

Shell: pwsh (7.4.6)

Prompt:

  User on Friday at 5:19 PM                                                               0s  MEM: 61% (19/31GB)
  {  home } 

Segments:

ConsoleTitle(true)                         -   0 ms
Session(true)                              -   0 ms
Time(true)                                 -   0 ms
Git(false)                                 -   3 ms
Text(false)                                -   0 ms
Executiontime(true)                        -   0 ms
Root(false)                                -   0 ms
Sysinfo(true)                              -   0 ms
Path(true)                                 -   0 ms
Status(true)                               -   0 ms

Run duration: 7.0001ms

Cache path: C:\Users\User\AppData\Local\oh-my-posh

Config path: C:\Users\User\AppData\Local\Programs\oh-my-posh\themes\1_shell.omp.json

Logs:

[DEBUG] 17:19:41.751 command.go:execute:989 → debug mode enabled
[DEBUG] 17:19:41.752 debug.go:40 → config set using POSH_THEME: C:\Users\User\AppData\Local\Programs\oh-my-posh\themes\1_shell.omp.json
[TRACE] 17:19:41.752 debug.go() - 0s
[TRACE] 17:19:41.752 load.go:Load() - 501.7µs
[TRACE] 17:19:41.752 debug.go() - 501.7µs
[DEBUG] 17:19:41.752 debug.go:52 → plain mode enabled
[TRACE] 17:19:41.753 terminal.go() - 0s
[DEBUG] 17:19:41.753 terminal.go:59 → loading cache file: C:\Users\User\AppData\Local\oh-my-posh\omp.cache
[DEBUG] 17:19:41.753 terminal.go:59 → loading cache key: upgrade
[TRACE] 17:19:41.753 terminal.go(C:\Users\User\AppData\Local\oh-my-posh\omp.cache) - 0s
[TRACE] 17:19:41.753 terminal.go() - 0s
[DEBUG] 17:19:41.753 terminal.go:59 → loading cache file: C:\Users\User\AppData\Local\oh-my-posh\omp.cache.70571877-ab3a-4dc1-8b63-82c2c4529f06
[DEBUG] 17:19:41.753 terminal.go:59 → loading cache key: prompt_count_cache
[DEBUG] 17:19:41.753 terminal.go:59 → loading cache key: template_cache
[TRACE] 17:19:41.753 terminal.go(C:\Users\User\AppData\Local\oh-my-posh\omp.cache.70571877-ab3a-4dc1-8b63-82c2c4529f06) - 0s
[TRACE] 17:19:41.753 terminal.go:Init() - 0s
[TRACE] 17:19:41.753 terminal.go() - 0s
[DEBUG] 17:19:41.753 terminal.go:Init:67 → C:\Users\User
[TRACE] 17:19:41.753 terminal.go:Init() - 0s
[TRACE] 17:19:41.753 debug.go() - 498.5µs
[TRACE] 17:19:41.753 init.go:Init() - 0s
[TRACE] 17:19:41.753 cache.go:loadCache() - 0s
[TRACE] 17:19:41.753 cache.go:loadCache() - 0s
[DEBUG] 17:19:41.753 debug.go:61 → terminal program: Windows Terminal
[DEBUG] 17:19:41.753 debug.go:61 → terminal shell: shell
[DEBUG] 17:19:41.753 config.go:MakeColors:58 → NO DATA
[TRACE] 17:19:41.753 config.go:MakeColors(OMP_CACHE_DISABLED) - 0s
[TRACE] 17:19:41.753 colors_windows.go:GetAccentColor(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor) - 0s
[DEBUG] 17:19:41.753 colors_windows.go:GetAccentColor:19 → ColorizationColor(DWORD): 0xC4CC7E76
[TRACE] 17:19:41.753 colors.go:SetAccentColor() - 0s
[TRACE] 17:19:41.753 colors.go:MakeColors() - 0s
[TRACE] 17:19:41.753 debug.go:PrintDebug() - 0s
[DEBUG] 17:19:41.753 debug.go:PrintDebug:16 → 7.4.6
[TRACE] 17:19:41.753 debug.go:PrintDebug(POSH_SHELL_VERSION) - 0s
[DEBUG] 17:19:41.753 debug.go:72 → segment: Title
[TRACE] 17:19:41.754 engine.go:getTitleTemplateText({{ .Folder }}) - 998.6µs
[TRACE] 17:19:41.754 primary.go:needsPrimaryRightPrompt() - 0s
[DEBUG] 17:19:41.754 terminal.go:CursorPosition:583 → 6
[TRACE] 17:19:41.754 terminal.go:CursorPosition(POSH_CURSOR_LINE) - 0s
[DEBUG] 17:19:41.754 terminal.go:CursorPosition:587 → 1
[TRACE] 17:19:41.754 terminal.go:CursorPosition(POSH_CURSOR_COLUMN) - 0s
[TRACE] 17:19:41.754 primary.go:writePrimaryPrompt() - 0s
[TRACE] 17:19:41.754 primary.go:writePrimaryPrompt() - 0s
[TRACE] 17:19:41.754 segment.go:Execute() - 0s
[TRACE] 17:19:41.754 segment.go:Execute() - 0s
[DEBUG] 17:19:41.754 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.754 segment.go:Execute() - 0s
[TRACE] 17:19:41.754 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.754 segment.go:Execute:110 → segment: Git
[DEBUG] 17:19:41.754 segment.go:Execute:110 → segment: Session
[DEBUG] 17:19:41.754 segment.go:Execute:112 → no toggles found
[DEBUG] 17:19:41.754 session.go:activeSSHSession:31 → NO DATA
[TRACE] 17:19:41.754 scm.go:hasCommand() - 0s
[TRACE] 17:19:41.754 session.go:activeSSHSession(SSH_CONNECTION) - 0s
[DEBUG] 17:19:41.754 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.754 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.754 segment.go:Execute:110 → segment: Time
[DEBUG] 17:19:41.754 segment.go:Execute:112 → no toggles found
[DEBUG] 17:19:41.754 session.go:activeSSHSession:31 → NO DATA
[DEBUG] 17:19:41.754 time.go:Enabled:27 → Monday <#ffffff>at</> 3:04 PM
[TRACE] 17:19:41.754 session.go:activeSSHSession(SSH_CLIENT) - 0s
[TRACE] 17:19:41.754 segment.go:string({{ .UserName }} <#ffffff>on</>) - 500.4µs
[TRACE] 17:19:41.754 segment.go:resolve(diamond) - 0s
[TRACE] 17:19:41.754 segment.go:string( {{ .CurrentDate | date .Format }} ) - 0s
[TRACE] 17:19:41.754 segment.go:resolve(diamond) - 0s
[DEBUG] 17:19:41.757 terminal.go:HasCommand:323 → C:\Program Files\Git\cmd\git.exe
[TRACE] 17:19:41.757 terminal.go:HasCommand(git.exe) - 3.4994ms
[TRACE] 17:19:41.757 scm.go:hasCommand(git.exe) - 3.4994ms
[DEBUG] 17:19:41.757 git.go:shouldDisplay:337 → fetch_bare_info: false
[DEBUG] 17:19:41.757 terminal.go:HasParentFilePath:446 → C:\Users\User
[TRACE] 17:19:41.757 terminal.go:HasParentFilePath(C:\Users\User) - 0s
[ERROR] 17:19:41.757 git.go:shouldDisplay:347 → CreateFile .git: The system cannot find the file specified.
[TRACE] 17:19:41.757 git.go:shouldDisplay(.git) - 0s
[TRACE] 17:19:41.757 segment.go:resolve(diamond) - 0s
[TRACE] 17:19:41.757 engine.go:applyPowerShellBleedPatch() - 0s
[TRACE] 17:19:41.757 segment.go:Execute() - 0s
[TRACE] 17:19:41.757 segment.go:Execute() - 0s
[DEBUG] 17:19:41.757 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.757 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.757 home.go:Home:26 → C:\Users\User
[DEBUG] 17:19:41.757 segment.go:Execute:110 → segment: Sysinfo
[TRACE] 17:19:41.757 segment.go:Execute() - 0s
[TRACE] 17:19:41.757 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.757 segment.go:Execute:112 → no toggles found
[DEBUG] 17:19:41.757 segment.go:Execute:110 → segment: Text
[DEBUG] 17:19:41.757 segment.go:Execute:112 → no toggles found
[TRACE] 17:19:41.757 segment.go:Execute() - 0s
[DEBUG] 17:19:41.757 sysinfo.go:Enabled:25 → precision: 2
[DEBUG] 17:19:41.757 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.757 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.757 segment.go:Execute:110 → segment: Executiontime
[DEBUG] 17:19:41.757 home.go:Home:26 → C:\Users\User
[DEBUG] 17:19:41.757 segment.go:Execute:112 → no toggles found
[TRACE] 17:19:41.757 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.757 segment.go:Execute:110 → segment: Root
[DEBUG] 17:19:41.757 executiontime.go:Enabled:55 → always_enabled: false
[TRACE] 17:19:41.757 segment.go:string(  ) - 0s
[DEBUG] 17:19:41.757 segment.go:Execute:112 → no toggles found
[TRACE] 17:19:41.757 executiontime.go:Enabled() - 0s
[TRACE] 17:19:41.757 segment.go:resolve(plain) - 0s
[DEBUG] 17:19:41.757 executiontime.go:Enabled:57 → threshold: 0.000000
[DEBUG] 17:19:41.757 executiontime.go:Enabled:61 → dallas
[TRACE] 17:19:41.757 root.go:Enabled() - 0s
[TRACE] 17:19:41.758 segment.go:string( {{ .FormattedMs }}s <#ffffff></>) - 499.7µs
[TRACE] 17:19:41.758 segment.go:resolve(diamond) - 0s
[TRACE] 17:19:41.758 segment.go:resolve(diamond) - 0s
[TRACE] 17:19:41.758 segment.go:string( <#ffffff>MEM:</> {{ round .PhysicalPercentUsed .Precision }}% ({{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB)) - 0s
[TRACE] 17:19:41.758 segment.go:resolve(diamond) - 0s
[DEBUG] 17:19:41.758 terminal_windows.go:TerminalWidth:99 → terminal width: 120
[TRACE] 17:19:41.758 engine.go:canWriteRightBlock() - 0s
[TRACE] 17:19:41.758 engine.go:applyPowerShellBleedPatch() - 0s
[TRACE] 17:19:41.758 segment.go:Execute() - 0s
[DEBUG] 17:19:41.758 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.758 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.758 segment.go:Execute:110 → segment: Status
[DEBUG] 17:19:41.758 segment.go:Execute:112 → no toggles found
[TRACE] 17:19:41.758 segment.go:Execute() - 0s
[TRACE] 17:19:41.758 status.go:Enabled() - 0s
[DEBUG] 17:19:41.758 status.go:formatStatus:45 → {{ .Code }}
[DEBUG] 17:19:41.758 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.758 terminal.go:DirMatchesOneOf() - 0s
[DEBUG] 17:19:41.758 segment.go:Execute:110 → segment: Path
[DEBUG] 17:19:41.758 segment.go:Execute:112 → no toggles found
[DEBUG] 17:19:41.758 path.go:147 → display_cygpath: false
[TRACE] 17:19:41.758 path.go:setPaths() - 0s
[TRACE] 17:19:41.758 path.go:setPaths() - 0s
[TRACE] 17:19:41.758 path.go:setPaths() - 0s
[TRACE] 17:19:41.758 path.go:setPaths() - 0s
[TRACE] 17:19:41.758 path.go:parsePath() - 0s
[TRACE] 17:19:41.758 status.go:formatStatus({{ .Code }}) - 0s
[DEBUG] 17:19:41.758 status.go:Enabled:37 → always_enabled: true
[DEBUG] 17:19:41.758 path.go:setMappedLocations:557 → mapped_locations_enabled: true
[DEBUG] 17:19:41.758 path.go:setMappedLocations:558 → 
[DEBUG] 17:19:41.758 path.go:setMappedLocations:559 → 
[DEBUG] 17:19:41.758 home.go:Home:26 → C:\Users\User
[TRACE] 17:19:41.758 clean.go:Clean() - 0s
[TRACE] 17:19:41.758 path.go:normalize() - 0s
[DEBUG] 17:19:41.758 path.go:setMappedLocations:560 → home
[DEBUG] 17:19:41.758 path.go:setMappedLocations:565 → mapped_locations: map[]
[TRACE] 17:19:41.758 clean.go:Clean() - 0s
[TRACE] 17:19:41.758 path.go:normalize() - 0s
[TRACE] 17:19:41.758 clean.go:Clean() - 0s
[TRACE] 17:19:41.758 path.go:normalize() - 0s
[TRACE] 17:19:41.758 path.go:parsePath() - 0s
[TRACE] 17:19:41.758 path.go:parsePath() - 0s
[TRACE] 17:19:41.758 path.go:parsePath() - 0s
[TRACE] 17:19:41.758 path.go:setStyle() - 0s
[DEBUG] 17:19:41.758 path.go:colorizePath:734 → cycle: []
[DEBUG] 17:19:41.758 path.go:getFolderSeparator:267 → NO DATA
[DEBUG] 17:19:41.758 path.go:getFolderSeparator:269 →  
[DEBUG] 17:19:41.758 path.go:colorizePath:737 → cycle_folder_separator: false
[DEBUG] 17:19:41.758 path.go:colorizePath:738 → %s
[DEBUG] 17:19:41.758 path.go:colorizePath:740 → %s
[DEBUG] 17:19:41.758 path.go:colorizePath:741 → %s
[DEBUG] 17:19:41.758 path.go:colorizePath:742 → %s
[TRACE] 17:19:41.758 path.go:Enabled() - 0s
[TRACE] 17:19:41.758 path.go:Enabled() - 0s
[TRACE] 17:19:41.758 path.go:Enabled() - 0s
[DEBUG] 17:19:41.758 terminal_windows.go:DirIsWritable:216 → not current user or in group
[DEBUG] 17:19:41.758 terminal_windows.go:DirIsWritable:216 → current user is member of S-1-5-32-544
[DEBUG] 17:19:41.758 win32_windows.go:isWriteable:271 ↓
    WRITE_DAC
    WRITE_OWNER
    SYNCHRONIZE
    DELETE
    READ_CONTROL
[DEBUG] 17:19:41.758 terminal_windows.go:DirIsWritable:216 → user has write access
[TRACE] 17:19:41.758 path.go:Enabled() - 501µs
[TRACE] 17:19:41.758 segment.go:string(  {{ .Path }} ) - 0s
[TRACE] 17:19:41.758 segment.go:resolve(diamond) - 0s
[TRACE] 17:19:41.758 segment.go:string(  ) - 0s
[TRACE] 17:19:41.758 list.go:FirstMatch({{ if gt .Code 0 }}#ef5350{{ end }}) - 0s
[TRACE] 17:19:41.758 segment.go:resolve(plain) - 0s
[TRACE] 17:19:41.758 list.go:FirstMatch({{ if gt .Code 0 }}#ef5350{{ end }}) - 0s
[TRACE] 17:19:41.758 engine.go:applyPowerShellBleedPatch() - 0s
[TRACE] 17:19:41.758 primary.go:writePrimaryPrompt() - 0s
[TRACE] 17:19:41.758 primary.go:Primary() - 0s
[TRACE] 17:19:41.758 debug.go:PrintDebug() - 0s
[TRACE] 17:19:41.758 debug.go:PrintDebug() - 0s
@MarwenDallel MarwenDallel added the 🐛 bug Something isn't working label Jan 3, 2025
JanDeDobbeleer added a commit that referenced this issue Jan 7, 2025
JanDeDobbeleer added a commit that referenced this issue Jan 7, 2025
JanDeDobbeleer added a commit that referenced this issue Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants