Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions bucket/everything-alpha.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,46 @@
"Set-Content \"$dir\\install-context.reg\" $reg_content -Encoding ASCII"
],
"pre_uninstall": [
"Stop-Process -Name 'everything' -Force -ErrorAction SilentlyContinue",
"if ($(Get-Service -Name Everything -ErrorAction SilentlyContinue).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",
"$appPathPattern = (Split-Path $dir -Parent).Replace('\\', '\\\\')",
"",
"$processes = Get-Process -Name 'everything' -ErrorAction SilentlyContinue",
" | Where-Object { $_.Path -match $appPathPattern }",
"info \"Found $($processes.Length) Everything process(es) to stop\"",
"foreach ($process in $processes) {",
" Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue",
"}",
Comment on lines +40 to 45
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Pipeline continuation will not work with | at the start of a new line.

In PowerShell, when the previous line is a complete statement (like an assignment), placing | at the start of the next line does not continue the pipeline—it either causes a syntax error or operates on $null. The pipe must be at the end of the preceding line.

Additionally, $processes.Length is unreliable because PowerShell doesn't wrap single objects in an array; .Length on a single Process object returns $null or a string length, not 1. Use @(...).Count to force array context.

Proposed fix
-        "$processes = Get-Process -Name 'everything' -ErrorAction SilentlyContinue",
-        "    | Where-Object { $_.Path -match $appPathPattern }",
-        "info \"Found $($processes.Length) Everything process(es) to stop\"",
+        "$processes = @(Get-Process -Name 'everything' -ErrorAction SilentlyContinue |",
+        "    Where-Object { $_.Path -match $appPathPattern })",
+        "info \"Found $($processes.Count) Everything process(es) to stop\"",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"$processes = Get-Process -Name 'everything' -ErrorAction SilentlyContinue",
" | Where-Object { $_.Path -match $appPathPattern }",
"info \"Found $($processes.Length) Everything process(es) to stop\"",
"foreach ($process in $processes) {",
" Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue",
"}",
"$processes = @(Get-Process -Name 'everything' -ErrorAction SilentlyContinue |",
" Where-Object { $_.Path -match $appPathPattern })",
"info \"Found $($processes.Count) Everything process(es) to stop\"",
"foreach ($process in $processes) {",
" Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue",
"}",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bucket/everything-alpha.json` around lines 40 - 45, The pipeline continuation
is broken because the pipe is on the next line and $processes.Length is
unreliable for single items; change the pipeline so the pipe is at the end of
the Get-Process line (i.e., Put the "|" at the end of the Get-Process command
before Where-Object) and replace uses of $processes.Length with an explicit
array-wrapping count like @($processes).Count; update the block that uses
$processes (the foreach and Stop-Process calls) to operate on the same corrected
$processes variable.

"if ((Get-Service -Name Everything -ErrorAction SilentlyContinue) -and ($cmd -eq 'uninstall')) {",
" if (!(is_admin)) { error 'Admin rights are required to remove Everything service'; break }",
" sc.exe delete 'Everything'",
"",
"$services = Get-Service -Name Everything* -ErrorAction SilentlyContinue",
" | Where-Object { $_.BinaryPathName -match $appPathPattern }",
Copy link
Copy Markdown
Member

@z-Fng z-Fng Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pipeline continuation will not work with | at the start of a new line.

I can reproduce this issue on PowerShell 5. And the BinaryPathName property is inaccessible.

"",
"if ($services.Length -gt 1) {",
" error 'Multiple Everything services found, this is likely a bug with this manifest.'",
" break",
"} elseif ($services.Length -eq 0) {",
" info 'No Everything service found, continuing with uninstall.'",
"} else {",
" $service = $services[0]",
" $serviceName = $service.Name",
" info \"Found Everything service: $serviceName\"",
Comment on lines +47 to +58
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Same pipeline continuation and array-handling issues in service detection.

Lines 47-48 have the same broken pipeline continuation (pipe at start of new line). Lines 50, 53 use .Length which is unreliable, and line 56's $services[0] will fail when PowerShell returns a single ServiceController object (not an array).

Wrap in @(...) to ensure array context throughout.

Proposed fix
-        "$services = Get-Service -Name Everything* -ErrorAction SilentlyContinue",
-        "    | Where-Object { $_.BinaryPathName -match $appPathPattern }",
+        "$services = @(Get-Service -Name Everything* -ErrorAction SilentlyContinue |",
+        "    Where-Object { $_.BinaryPathName -match $appPathPattern })",
         "",
-        "if ($services.Length -gt 1) {",
+        "if ($services.Count -gt 1) {",
             "error 'Multiple Everything services found, this is likely a bug with this manifest.'",
             "break",
-        "} elseif ($services.Length -eq 0) {",
+        "} elseif ($services.Count -eq 0) {",
             "info 'No Everything service found, continuing with uninstall.'",
         "} else {",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"$services = Get-Service -Name Everything* -ErrorAction SilentlyContinue",
" | Where-Object { $_.BinaryPathName -match $appPathPattern }",
"",
"if ($services.Length -gt 1) {",
" error 'Multiple Everything services found, this is likely a bug with this manifest.'",
" break",
"} elseif ($services.Length -eq 0) {",
" info 'No Everything service found, continuing with uninstall.'",
"} else {",
" $service = $services[0]",
" $serviceName = $service.Name",
" info \"Found Everything service: $serviceName\"",
"$services = @(Get-Service -Name Everything* -ErrorAction SilentlyContinue |",
" Where-Object { $_.BinaryPathName -match $appPathPattern })",
"",
"if ($services.Count -gt 1) {",
" error 'Multiple Everything services found, this is likely a bug with this manifest.'",
" break",
"} elseif ($services.Count -eq 0) {",
" info 'No Everything service found, continuing with uninstall.'",
"} else {",
" $service = $services[0]",
" $serviceName = $service.Name",
" info \"Found Everything service: $serviceName\"",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bucket/everything-alpha.json` around lines 47 - 58, The service-detection
block using Get-Service and $appPathPattern is broken by a leading pipe and
treats $services unreliably as a scalar; fix it by ensuring the pipeline
operator is at the end of the Get-Service line (or wrap the whole pipeline in
@(...)) and coerce results into an array with @(...): call Get-Service -Name
Everything* -ErrorAction SilentlyContinue | Where-Object { $_.BinaryPathName
-match $appPathPattern } inside @(...) so $services = @(...), then replace
.Length checks with array-safe checks (e.g. ($services).Count or test array
membership) and replace direct indexing $services[0] with stable access after
the @(...) coercion so single results are handled correctly.

"",
" if (!(is_admin)) {",
" error 'Administrator rights are required to manage Windows services'",
" break",
" }",
"",
" if ($service.Status -ne 'Stopped') {",
" info 'Stopping service'",
" Stop-Service -Name $serviceName -Force | Out-Null",
" }",
"",
" if ($cmd -eq 'uninstall') {",
" info 'Removing service'",
" sc.exe delete $serviceName",
" }",
Comment on lines +70 to +73
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Quote $serviceName when calling sc.exe to handle names with spaces.

Per issue #2216, service names like "Everything (1.5a)" contain spaces and parentheses. Passing $serviceName unquoted to sc.exe will cause the command to fail. Wrap in quotes.

Proposed fix
-        "sc.exe delete $serviceName",
+        "sc.exe delete `\"$serviceName`\"",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bucket/everything-alpha.json` around lines 70 - 73, The uninstall branch
calls sc.exe with an unquoted $serviceName which will break for service names
containing spaces or parentheses; update the uninstall block where $serviceName
is used (the "if ($cmd -eq 'uninstall')" branch invoking sc.exe) to pass the
service name wrapped in quotes (e.g., ensure the argument to sc.exe is
"\"$serviceName\"" or the equivalent quoting method your PowerShell script uses)
so sc.exe receives the full name as a single argument.

"}",
"",
"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', 'Session*.json', 'NO_ALPHA_INSTANCE', 'Omit Results.csv' | Copy-Item -Destination \"$persist_dir\" -ErrorAction SilentlyContinue -Force"
],
"bin": "Everything.exe",
Expand Down