Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(install): three Windows install failures on a stock machine (#1252)

antigravitysoham-eng5ae03798c537
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..decf5854d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+# Shell scripts run inside Linux containers. A CRLF checkout (Git for Windows
+# defaults to core.autocrlf=true) makes postgres initdb fail with
+# "env: can't execute 'bash\r'" and exit 127.
+*.sh text eol=lf
+Makefile text eol=lf
+# Windows PowerShell 5.1 parses BOM-less scripts as ANSI; keep these UTF-8 with
+# a BOM (committed that way) and CRLF on checkout.
+*.ps1 text eol=crlf
diff --git a/install.ps1 b/install.ps1
index 83418722c..0338a3bf3 100644
--- a/install.ps1
+++ b/install.ps1
@@ -1,4 +1,4 @@
-<#
+<#
.SYNOPSIS
AiSOC — One-Click Installer for Windows.
@@ -758,7 +758,20 @@ $script:CorePortSpecs = @(
# stack must not be reported as a conflict with itself.
function Get-ComposePublishedPort {
param([Parameter(Mandatory)][string]$Service, [Parameter(Mandatory)][int]$ContainerPort)
- $mapped = & docker compose port $Service $ContainerPort 2>$null | Select-Object -Last 1
+ # Under $ErrorActionPreference = 'Stop', Windows PowerShell 5.1 turns a
+ # native command's stderr into a terminating error even with 2>$null, so
+ # "service "postgres" is not running" on a first install killed the
+ # installer before anything had started. Not running is the answer here.
+ $mapped = $null
+ $previous = $ErrorActionPreference
+ try {
+ $ErrorActionPreference = 'Continue'
+ $mapped = & docker compose port $Service $ContainerPort 2>$null | Select-Object -Last 1
+ } catch {
+ return $null
+ } finally {
+ $ErrorActionPreference = $previous
+ }
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($mapped)) { return $null }
$tail = ("$mapped" -split ':')[-1]
$parsed = 0
diff --git a/tests/test_installer_parity_gate.py b/tests/test_installer_parity_gate.py
index 1fe28421c..68a31353c 100644
--- a/tests/test_installer_parity_gate.py
+++ b/tests/test_installer_parity_gate.py
@@ -42,7 +42,15 @@ DEMO_HANDOFF = "pnpm aisoc:demo"
def _read(path: Path) -> str:
assert path.is_file(), f"{path.relative_to(REPO)} is missing"
- return path.read_text(encoding="utf-8")
+ # utf-8-sig, not utf-8: install.ps1 is committed **with** a BOM on
+ # purpose, because Windows PowerShell 5.1 parses a BOM-less script as
+ # ANSI and mangles every non-ASCII character in it. Read as plain utf-8
+ # the BOM survives as a leading \ufeff, so the first line is
+ # "\ufeff<#" rather than "<#", `_code_lines` never enters the block
+ # comment, and the whole header is scanned as if it were code — which
+ # made this gate report that the installer *executes* the demo stack
+ # while reading a comment saying it does not.
+ return path.read_text(encoding="utf-8-sig")
def _code_lines(text: str) -> list[str]:
diff --git a/uninstall.ps1 b/uninstall.ps1
index 57b98992a..cf5e9a1cf 100644
--- a/uninstall.ps1
+++ b/uninstall.ps1
@@ -1,4 +1,4 @@
-<#
+<#
.SYNOPSIS
AiSOC — Uninstaller for Windows.