Skip to content

PowerShell update checker ignores POWERSHELL_UPDATECHECK environment variable #3226

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

Closed
trolleyboy opened this issue Mar 5, 2021 · 17 comments · Fixed by #4306
Closed

PowerShell update checker ignores POWERSHELL_UPDATECHECK environment variable #3226

trolleyboy opened this issue Mar 5, 2021 · 17 comments · Fixed by #4306
Assignees
Labels
Area-Startup Issue-Enhancement A feature request (enhancement).

Comments

@trolleyboy
Copy link

System Details

System Details Output

### VSCode version: 1.53.2 622cb03f7e070a9670c94bae1a45d78d7181fbd4 x64

### VSCode extensions:
[email protected]     
[email protected] 
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version: 2.3.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.0.5
PSEdition                      Core
GitCommitId                    7.0.5
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

I am experiencing a problem with...
VS Code notifies as follows...

You have an old version of PowerShell (7.0.5). The current latest release is v7.1.2. Would you like to update the version? (This will close ALL pwsh terminals running in this Visual Studio Code session)

However I have set $Env:POWERSHELL_UPDATECHECK to "LTS" per https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-70?view=powershell-7.1#new-version-notification

Expected Behaviour

I'd expect the notification to only appear when updates to the LTS version of Powershell 7 are available. EG: 7.0.6.

Actual Behaviour

VS Code notifies as follows...

You have an old version of PowerShell (7.0.5). The current latest release is v7.1.2. Would you like to update the version? (This will close ALL pwsh terminals running in this Visual Studio Code session)

Attached Logs

Follow the instructions in the [troubleshooting docs](https://github.com/PowerShell/vscode-powershell/blob/master/docs/troubleshooting.md#logs
vscode-powershell.zip
vscode-powershell.zip

)
about capturing and sending logs.

@ghost ghost added the Needs: Triage Maintainer attention needed! label Mar 5, 2021
@rjmholt
Copy link
Contributor

rjmholt commented Mar 5, 2021

Do you get the update notification when you start pwsh.exe with that environment variable set?

@trolleyboy
Copy link
Author

No, it only seems to occur when the Powershell Integrated Console in VS Code starts up (which is every time I start VS Code).
I can see that pwsh is started first, but no notification. Then the integrated console is started and the notification appears.

I was getting this notification in pwsh.exe before I set the environment variable a few weeks ago.

@rjmholt
Copy link
Contributor

rjmholt commented Mar 5, 2021

How/where are you setting the environment variable?

@trolleyboy
Copy link
Author

I have it set as a System variable (I vaguely recall running $Env:POWERSHELL_UPDATECHECK = 'LTS' in an elevated PS console).

image

@SydneyhSmith
Copy link
Collaborator

Thanks @trolleyboy VSCode does not check for this variable when it runs its update mechanism, but this is a reasonable feature request to add a check for...thanks for catching and reporting this!

@SydneyhSmith SydneyhSmith added Area-Startup Issue-Enhancement A feature request (enhancement). and removed Needs: Triage Maintainer attention needed! labels Mar 9, 2021
@Liturgist
Copy link

Liturgist commented Nov 8, 2021

I am experiencing the same issue. VSCode tells me that the current latest release is v7.2.0. It does not mention that it is the preview version, rc1. It really should so that the user can make an informed decision.

https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-rc.1/PowerShell-7.2.0-rc.1-win-x64.msi

image

PS C:\Users\pwatson2> code --version
1.61.2
6cba118ac49a1b88332f312a8f67186f7f3c1643
x64
PS C:\Users\pwatson2> code --list-extensions --show-versions | Select-String -Pattern powershell

[email protected]
[email protected]

PS C:\Users\pwatson2> $PSVersionTable                          

Name                           Value
----                           -----
PSVersion                      7.1.5
PSEdition                      Core
GitCommitId                    7.1.5
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 8, 2021
@JustinGrote
Copy link
Collaborator

JustinGrote commented Nov 8, 2021

@Liturgist 7.2 is an LTS version, unless I'm missing something, this is as-expected. If it prompts you for 7.3.x when that chain starts, then there is a problem.

Also it's not the preview version as you stated, 7.2 LTS was released today as RTM.

@andyleejordan
Copy link
Member

I think this still might be misbehaving. Ideally if you're on an LTS it wouldn't prompt you to update to the "next LTS," just updates to your current LTS until it's out of support. Confirming now if the 7.2 update means 7.0 LTS Is no longer supported.

@andyleejordan
Copy link
Member

Yeah, 7.0 LTS isn't end-of-life until December 3, 2022, so while 7.2 is an LTS, in this case I do not think the update check should be prompting the user.

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 8, 2021
@andyleejordan andyleejordan self-assigned this Nov 8, 2021
@andyleejordan andyleejordan added this to the Consider-vNext milestone Nov 8, 2021
@andyleejordan
Copy link
Member

Closer examination of this issue is that it is still a feature request for the editor to respect this variable. But I agree with @Liturgist that this is a bug in PowerShell's update checker.

@andyleejordan
Copy link
Member

I almost filed a bug...but actually @Liturgist you're running a non-LTS, 7.1.5. So nevermind all I said! It is strange that the update is pointing you at an RC, I'm guessing this was a cache issue and it prompted you to update before the 7.2 release (non-RC) refreshed on GitHub.

@Liturgist
Copy link

I almost filed a bug...but actually @Liturgist you're running a non-LTS, 7.1.5. So nevermind all I said! It is strange that the update is pointing you at an RC, I'm guessing this was a cache issue and it prompted you to update before the 7.2 release (non-RC) refreshed on GitHub.

@andschwa, what steps can I take to remove this "cache issue?"

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 9, 2021
@JustinGrote
Copy link
Collaborator

@andschwa so I agree the end-behavior (confirmed by tests) should be as such:

  1. If you are on an LTS, do not prompt to update your LTS until it is 30 days to EOS or something (how would we know? More info in the Powershell repo metadata.json?)
  2. If you are on non-LTS, prompt to always update to the latest, and if LTS is latest, then so be it.

@andyleejordan
Copy link
Member

@andschwa, what steps can I take to remove this "cache issue?"

It should be gone now!

@andyleejordan
Copy link
Member

(confirmed by tests)

Are you saying this is indeed working as intended @JustinGrote?

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 9, 2021
@JustinGrote
Copy link
Collaborator

No I'm saying we should have tests to confirm that if we fix it :)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Nov 9, 2021
@StevenBucher98 StevenBucher98 removed the Needs: Maintainer Attention Maintainer attention needed! label Nov 9, 2021
@SydneyhSmith SydneyhSmith removed this from the Consider-vNext milestone Aug 11, 2022
@andyleejordan andyleejordan moved this from Todo to Missed in American Pharoah Oct 4, 2022
@andyleejordan andyleejordan changed the title Prompted to update Powershell to non-LTS version even when $Env:POWERSHELL_UPDATECHECK is set to LTS PowerShell update checker ignores POWERSHELL_UPDATECHECK environment variable Dec 5, 2022
@andyleejordan
Copy link
Member

It took a while, but I got around to fixing this 😄

Repository owner moved this from Punted to Done in American Pharoah Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Startup Issue-Enhancement A feature request (enhancement).
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants