-
-
Notifications
You must be signed in to change notification settings - Fork 236
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all issues/PRs to ensure it has not already been reported or fixed.
- I have verified that I am using the latest version of Scoop and corresponding bucket.
Package Name
everything-alpha
Expected/Current Behaviour
The pre_uninstall
script does not check properly whether an Everything service exists or not.
First of all, the name of the service, at least on my side, is not the right one, it’s Everything (1.5a)
.
Second, the code $(Get-Service -Name Everything -ErrorAction SilentlyContinue).Status -ne 'Stopped'
will actually be $true
also when there is no service, since $(Get-Service -Name Everything -ErrorAction SilentlyContinue).Status
returns $nil
in that case, and indeed it is not equal to 'Stopped'
.
Steps to Reproduce
When there is an update for everything-alpha
, try updating and see it fail.
Possible Solution
extras/everything
already works better in that case, it checks beforehand if the service actually exists, and if it uses the scoop installed Everything instance. However, I’m not really too fan on using an external tool when PowerShell already provides the functionality, and on performing a string match on a whole unformatted output.
Here’s how it could be fixed directly in PowerShell:
$service = Get-Service -Name Everything* -ErrorAction SilentlyContinue
, with the*
added it will work for any variant of the service name, including with a version specifier like in my case$service.BinaryPathName -match $dir.Replace('\\', '\\\\')
, to reuse the logic seen forextras/everything
, but while keeping on using what PowerShell provides. Not that this will be$true
only if the service exists and corresponds to that installation, so it will take into account the inexistence of the service this time$service.Status -ne 'Stopped'
, like before
I would suggest replicating this logic to every other Everything package in scoop buckets, since it seems more robust (unless I missed something important).
Of course, now there can be other issues during update if the service is actually present: #1337
Here’s the git diff of the proposed solution:
"pre_uninstall": [
"Stop-Process -Name 'everything' -Force -ErrorAction SilentlyContinue",
- "if ($(Get-Service -Name Everything -ErrorAction SilentlyContinue).Status -ne 'Stopped') {",
+ "$service = Get-Service -Name Everything* -ErrorAction SilentlyContinue",
+ "if ($service.BinaryPathName -match $dir.Replace('\\', '\\\\')) {",
+ " if ($service.Status -ne 'Stopped') {",
" if (!(is_admin)) { error 'Admin rights are required to stop Everything service'; break }",
" Stop-Service -Name 'Everything' -Force -ErrorAction SilentlyContinue | Out-Null",
" }",
- "if ((Get-Service -Name Everything -ErrorAction SilentlyContinue) -and ($cmd -eq 'uninstall')) {",
+ " if ($cmd -eq 'uninstall') {",
" if (!(is_admin)) { error 'Admin rights are required to remove Everything service'; break }",
" sc.exe delete 'Everything'",
" }",
+ "}",
"if ($cmd -eq 'uninstall') { reg import \"$dir\\uninstall-context.reg\" }",
"Get-ChildItem \"$dir\\*\" -Include 'Bookmarks*.csv', 'Everything.lng', 'Everything*.db', 'Everything*.ini', 'Filters*.csv', 'Plugins*.ini', 'Run History*.csv', 'Search History*.csv' | Copy-Item -Destination \"$persist_dir\" -ErrorAction SilentlyContinue -Force"
],
Scoop and Buckets Version
I trimmed down the output to keep only the relevant buckets:
Current Scoop version:
859d1db5 (HEAD -> master, tag: v0.5.2, origin/master, origin/HEAD) chore(release): Bump to version 0.5.2 (#6080)
'main' bucket:
3215c64d5 (HEAD -> master, origin/master, origin/HEAD) sqruff: Update to version 0.25.20
'extras' bucket:
dcf7ba3ee4 (HEAD -> master, origin/master, origin/HEAD) vroid-studio: Update to version 2.1.5
'versions' bucket:
8c7301bb6 (HEAD -> master, origin/master, origin/HEAD) vscode-insiders: Update to version 1.99.0-1743051838875
Scoop Config
last_update : 3/27/2025 10:44:40 AM
use_lessmsi : True
aria2-enabled : False
scoop_branch : master
scoop_repo : https://github.com/ScoopInstaller/Scoop
PowerShell Version
Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Additional Softwares
N/A