Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix: harden cross-platform daemon startup
Martin Vogel98a28473dbbf
diff --git a/scripts/test-windows.ps1 b/scripts/test-windows.ps1index 72b287eda..ee1939ccc 100644--- a/scripts/test-windows.ps1+++ b/scripts/test-windows.ps1@@ -3,10 +3,10 @@Run the native-Windows product-surface test suite for codebase-memory-mcp..DESCRIPTION- Builds the product binary (build/c/codebase-memory-mcp.exe) if it is not- already present, then runs the deterministic Windows integration tests under- tests/windows/ against a real codebase-memory-mcp.exe (real stdio / CLI /- HTTP UI, real SQLite DB).+ Builds the payload and permanent launcher if they are not already present,+ stages them under their release names, then runs the deterministic Windows+ integration tests under tests/windows/ through the launcher (real stdio /+ CLI / HTTP UI, real SQLite DB).Two categories of test:@@ -95,8 +95,9 @@ function Resolve-Binary {$built = Join-Path $repoRoot "build\c\codebase-memory-mcp.exe"if (Test-Path $built) { return $built }Write-Host "Building $Target via Makefile.cbm ..." -ForegroundColor Cyan- & $Make "-j" "-f" "Makefile.cbm" $Target "SANITIZE=" "TMP=$tmp" "TEMP=$tmp" "TMPDIR=$tmp"- if ($LASTEXITCODE -ne 0) { throw "build failed (exit $LASTEXITCODE)" }+ & $Make "-j" "-f" "Makefile.cbm" $Target "SANITIZE=" "TMP=$tmp" "TEMP=$tmp" "TMPDIR=$tmp" | Out-Host+ $buildExit = $LASTEXITCODE+ if ($buildExit -ne 0) { throw "build failed (exit $buildExit)" }if (-not (Test-Path $built)) { throw "binary not produced at $built" }return $built}@@ -107,8 +108,9 @@ function Resolve-Launcher {$built = Join-Path $repoRoot "build\c\codebase-memory-mcp-launcher.exe"if (Test-Path $built) { return $built }Write-Host "Building permanent launcher via Makefile.cbm ..." -ForegroundColor Cyan- & $Make "-j" "-f" "Makefile.cbm" "cbm-launcher" "SANITIZE=" "TMP=$tmp" "TEMP=$tmp" "TMPDIR=$tmp"- if ($LASTEXITCODE -ne 0) { throw "launcher build failed (exit $LASTEXITCODE)" }+ & $Make "-j" "-f" "Makefile.cbm" "cbm-launcher" "SANITIZE=" "TMP=$tmp" "TEMP=$tmp" "TMPDIR=$tmp" | Out-Host+ $buildExit = $LASTEXITCODE+ if ($buildExit -ne 0) { throw "launcher build failed (exit $buildExit)" }if (-not (Test-Path $built)) { throw "launcher not produced at $built" }return $built}@@ -117,8 +119,9 @@ function Resolve-AbiMismatchLauncher {$built = Join-Path $repoRoot "build\c\codebase-memory-mcp-launcher-abi2.exe"if (Test-Path $built) { return $built }Write-Host "Building launcher ABI mismatch fixture via Makefile.cbm ..." -ForegroundColor Cyan- & $Make "-j" "-f" "Makefile.cbm" "build/c/codebase-memory-mcp-launcher-abi2.exe" "SANITIZE=" "TMP=$tmp" "TEMP=$tmp" "TMPDIR=$tmp"- if ($LASTEXITCODE -ne 0) { throw "launcher ABI fixture build failed (exit $LASTEXITCODE)" }+ & $Make "-j" "-f" "Makefile.cbm" "build/c/codebase-memory-mcp-launcher-abi2.exe" "SANITIZE=" "TMP=$tmp" "TEMP=$tmp" "TMPDIR=$tmp" | Out-Host+ $buildExit = $LASTEXITCODE+ if ($buildExit -ne 0) { throw "launcher ABI fixture build failed (exit $buildExit)" }if (-not (Test-Path $built)) { throw "launcher ABI fixture not produced at $built" }return $built}@@ -130,8 +133,17 @@ Write-Host "Payload: $bin" -ForegroundColor GreenWrite-Host "Launcher: $launcherBin" -ForegroundColor GreenWrite-Host "ABI mismatch fixture: $abiMismatchLauncher" -ForegroundColor Green-$env:PYTHONUTF8 = "1" # encode argv/stdio as UTF-8-$env:CBM_INDEX_SUPERVISOR = "0" # in-process indexing (see .DESCRIPTION)+$guardBundle = Join-Path $tmp ("cbm-windows-guards-" + [guid]::NewGuid().ToString("N"))+New-Item -ItemType Directory -Path $guardBundle | Out-Null+$guardBin = Join-Path $guardBundle "codebase-memory-mcp.exe"+$guardPayload = Join-Path $guardBundle "codebase-memory-mcp.payload.exe"+Copy-Item -LiteralPath $launcherBin -Destination $guardBin+Copy-Item -LiteralPath $bin -Destination $guardPayload+Write-Host "Guard bundle: $guardBin" -ForegroundColor Green++try {+ $env:PYTHONUTF8 = "1" # encode argv/stdio as UTF-8+ $env:CBM_INDEX_SUPERVISOR = "0" # in-process indexing (see .DESCRIPTION)# Green regression guards - must stay GREEN (exit 0). RED (exit 1) = the fix for# the referenced issue regressed. The drive-picker guard needs the embedded HTTP@@ -158,14 +170,14 @@ Write-Host "`n--- Green guards ---" -ForegroundColor Cyanforeach ($t in $guards) {Write-Host "`n=== $t ===" -ForegroundColor Cyanif ($t -eq "tests\windows\test_windows_launcher.py") {- & $py $t $launcherBin $bin $abiMismatchLauncher+ & $py $t $guardBin $guardPayload $abiMismatchLauncher} else {- & $py $t $bin+ & $py $t $guardBin}$code = $LASTEXITCODEif ($code -eq 0) {Write-Host "GREEN ($t)" -ForegroundColor Green- } elseif ($code -eq 1) {+ } elseif ($code -eq 1 -or $t -eq "tests\windows\test_windows_launcher.py") {Write-Host "RED ($t) - REGRESSION: a fixed Windows bug is broken again" -ForegroundColor Red$guardFailures += $t} else {@@ -178,7 +190,7 @@ if (-not $GuardsOnly) {Write-Host "`n--- Known reds (opt-in, expected red) ---" -ForegroundColor Cyanforeach ($t in $knownReds) {Write-Host "`n=== $t ===" -ForegroundColor Cyan- & $py $t $bin+ & $py $t $guardBin$code = $LASTEXITCODEif ($code -eq 1) {Write-Host "RED ($t) - expected; the underlying Windows bug is still open" -ForegroundColor DarkYellow@@ -190,6 +202,9 @@ if (-not $GuardsOnly) {}}}+} finally {+ Remove-Item -LiteralPath $guardBundle -Recurse -Force -ErrorAction SilentlyContinue+}Write-Host ""if ($guardSkips.Count -gt 0) {diff --git a/scripts/test_mcp_interactive.py b/scripts/test_mcp_interactive.pyindex 4db2a902c..47c7249e8 100644--- a/scripts/test_mcp_interactive.py+++ b/scripts/test_mcp_interactive.py@@ -10,7 +10,9 @@ from __future__ import annotationsimport argparseimport json+import osimport queue+import shutilimport subprocessimport sysimport threading@@ -29,6 +31,23 @@ class SmokeFailure(RuntimeError):pass+def mcp_command(binary: str) -> list[str]:+ """Select a direct product launch or an explicit Windows shebang runner."""+ if os.name != "nt":+ return [binary]+ try:+ with open(binary, "rb") as stream:+ shebang = stream.read(2) == b"#!"+ except OSError:+ return [binary]+ if not shebang:+ return [binary]+ bash = shutil.which("bash")+ if not bash:+ raise SmokeFailure("Windows shebang MCP fixture requires bash on PATH")+ return [bash, binary]++def read_json_lines(stream: BinaryIO,responses: "queue.Queue[dict[str, Any]]",@@ -275,13 +294,18 @@ def main() -> int:parser.add_argument("--exit-timeout", type=float, default=15.0)args = parser.parse_args()- process = subprocess.Popen(- [args.binary],- stdin=subprocess.PIPE,- stdout=subprocess.PIPE,- stderr=subprocess.PIPE,- bufsize=0,- )+ try:+ command = mcp_command(args.binary)+ process = subprocess.Popen(+ command,+ stdin=subprocess.PIPE,+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ bufsize=0,+ )+ except (OSError, SmokeFailure) as error:+ print(f"FAIL: could not start MCP server: {error}", file=sys.stderr)+ return 1assert process.stdout is not Noneassert process.stderr is not Noneresponses: "queue.Queue[dict[str, Any]]" = queue.Queue()diff --git a/src/daemon/bootstrap.c b/src/daemon/bootstrap.cindex 8a74aca6b..ff080114d 100644--- a/src/daemon/bootstrap.c+++ b/src/daemon/bootstrap.c@@ -30,6 +30,7 @@#include <sys/wait.h>#include <unistd.h>#ifdef __APPLE__+#include <pthread.h>#include <spawn.h>extern char **environ;#endif@@ -519,6 +520,9 @@ typedef struct bootstrap_production_cohort {typedef struct {bootstrap_production_cohort_t *cohort;+#ifdef __APPLE__+ int spawn_error;+#endif} bootstrap_production_context_t;static cbm_daemon_bootstrap_probe_status_t bootstrap_production_probe(@@ -737,7 +741,7 @@ static bool bootstrap_darwin_spawn_state_init(posix_spawn_file_actions_t *action}sigset_t empty;(void)sigemptyset(&empty);- short flags = POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_CLOEXEC_DEFAULT;+ short flags = POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSID | POSIX_SPAWN_CLOEXEC_DEFAULT;if (posix_spawnattr_setsigmask(attributes, &empty) != 0 ||posix_spawnattr_setflags(attributes, flags) != 0) {(void)posix_spawnattr_destroy(attributes);@@ -747,19 +751,50 @@ static bool bootstrap_darwin_spawn_state_init(posix_spawn_file_actions_t *actionreturn true;}-static void bootstrap_daemon_grandchild(const cbm_daemon_bootstrap_launch_spec_t *spec,- const posix_spawn_file_actions_t *actions,- const posix_spawnattr_t *attributes) {- (void)umask(077);- pid_t daemon = 0;- int status = posix_spawn(&daemon, spec->executable_path, actions, attributes,- (char *const *)spec->argv, environ);- _exit(status == 0 ? 0 : 127);+typedef struct {+ pid_t pid;+} bootstrap_darwin_reaper_t;++static void *bootstrap_darwin_reap(void *opaque) {+ bootstrap_darwin_reaper_t *reaper = opaque;+ int status = 0;+ pid_t waited;+ do {+ waited = waitpid(reaper->pid, &status, 0);+ } while (waited < 0 && errno == EINTR);+ free(reaper);+ return NULL;+}++static bool bootstrap_darwin_reaper_start(pid_t daemon) {+ bootstrap_darwin_reaper_t *reaper = malloc(sizeof(*reaper));+ if (!reaper) {+ return false;+ }+ reaper->pid = daemon;+ pthread_attr_t attributes;+ bool attributes_ready = pthread_attr_init(&attributes) == 0;+ bool detached =+ attributes_ready && pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED) == 0;+ pthread_t thread;+ int thread_status =+ detached ? pthread_create(&thread, &attributes, bootstrap_darwin_reap, reaper) : -1;+ if (attributes_ready) {+ (void)pthread_attr_destroy(&attributes);+ }+ if (thread_status != 0) {+ free(reaper);+ return false;+ }+ return true;}static bool bootstrap_production_spawn(void *context,const cbm_daemon_bootstrap_launch_spec_t *spec) {- (void)context;+ bootstrap_production_context_t *production = context;+ if (production) {+ production->spawn_error = 0;+ }if (!spec || !spec->detached || spec->inherit_standard_handles || spec->use_shell) {return false;}@@ -768,38 +803,33 @@ static bool bootstrap_production_spawn(void *context,if (!bootstrap_darwin_spawn_state_init(&actions, &attributes)) {return false;}- pid_t first = fork();- if (first < 0) {- (void)posix_spawnattr_destroy(&attributes);- (void)posix_spawn_file_actions_destroy(&actions);+ /* Calling library-heavy process creation between fork() and exec is not a+ * safe boundary once another thread may own libc state. Darwin's spawn+ * primitive can create the detached session and close inherited FDs in+ * one operation, so launch it from the original process and retain only a+ * tiny detached waiter to prevent a crashed daemon from becoming a+ * long-lived zombie owned by the first frontend. */+ pid_t daemon = 0;+ int spawn_status = posix_spawn(&daemon, spec->executable_path, &actions, &attributes,+ (char *const *)spec->argv, environ);+ (void)posix_spawnattr_destroy(&attributes);+ (void)posix_spawn_file_actions_destroy(&actions);+ if (production) {+ production->spawn_error = spawn_status;+ }+ if (spawn_status != 0) {return false;}- if (first == 0) {- if (setsid() < 0) {- _exit(127);- }- pid_t grandchild = fork();- if (grandchild < 0) {- _exit(127);- }- if (grandchild > 0) {- _exit(0);+ if (!bootstrap_darwin_reaper_start(daemon)) {+ (void)kill(daemon, SIGKILL);+ int status = 0;+ while (waitpid(daemon, &status, 0) < 0 && errno == EINTR) {}+ if (production) {+ production->spawn_error = EAGAIN;}- /* Darwin commonly reports OPEN_MAX near one million. Iterating every- * possible descriptor after fork can consume the entire cold-start- * budget. CLOEXEC_DEFAULT closes the actual inherited set in the- * kernel while the double fork still provides daemon detachment. */- bootstrap_daemon_grandchild(spec, &actions, &attributes);+ return false;}-- int status = 0;- pid_t waited;- do {- waited = waitpid(first, &status, 0);- } while (waited < 0 && errno == EINTR);- (void)posix_spawnattr_destroy(&attributes);- (void)posix_spawn_file_actions_destroy(&actions);- return waited == first && WIFEXITED(status) && WEXITSTATUS(status) == 0;+ return true;}#elsestatic void bootstrap_child_close_fds(void) {@@ -864,7 +894,18 @@ static bool bootstrap_production_spawn(void *context,#endifstatic void bootstrap_production_diagnostic(void *context, const char *message) {- (void)context;+ bootstrap_production_context_t *production = context;+#ifdef __APPLE__+ if (production && production->spawn_error != 0) {+ (void)fprintf(stderr, "codebase-memory-mcp: %s (daemon launch: %s)\n",+ message ? message : "daemon startup failed",+ strerror(production->spawn_error));+ (void)fflush(stderr);+ return;+ }+#else+ (void)production;+#endif(void)fprintf(stderr, "codebase-memory-mcp: %s\n", message ? message : "daemon startup failed");(void)fflush(stderr);}diff --git a/src/launcher/windows_launcher.c b/src/launcher/windows_launcher.cindex 4b5c09b48..d2d9ee0c8 100644--- a/src/launcher/windows_launcher.c+++ b/src/launcher/windows_launcher.c@@ -279,8 +279,18 @@ static HANDLE launcher_open_directory_private(const wchar_t *path) {static bool launcher_path_tree_plain(const wchar_t *file_path) {size_t length = wcslen(file_path);- if (length < 4U || length >= CBM_WINDOWS_LAUNCHER_PATH_CAP || file_path[1] != L':' ||- (file_path[2] != L'\\' && file_path[2] != L'/')) {+ size_t root_length = 0U;+ if (length >= 4U && file_path[1] == L':' && (file_path[2] == L'\\' || file_path[2] == L'/')) {+ root_length = 3U;+ } else if (length >= 8U && file_path[0] == L'\\' && file_path[1] == L'\\' &&+ file_path[2] == L'?' && file_path[3] == L'\\' && file_path[5] == L':' &&+ (file_path[6] == L'\\' || file_path[6] == L'/')) {+ /* GetModuleFileNameW preserves the path format used to launch the+ * process. Keep an extended DOS path extended while walking it so+ * every ACL/reparse check names the exact object that was executed. */+ root_length = 7U;+ }+ if (root_length == 0U || length <= root_length || length >= CBM_WINDOWS_LAUNCHER_PATH_CAP) {return false;}wchar_t *path = malloc((length + 1U) * sizeof(*path));@@ -292,14 +302,14 @@ static bool launcher_path_tree_plain(const wchar_t *file_path) {path[index] = L'\\';}wchar_t *last = wcsrchr(path, L'\\');- if (!last || last <= path + 2) {+ if (!last || last < path + root_length) {free(path);return false;}*last = L'\0';size_t directory_length = wcslen(path);bool valid = true;- for (size_t index = 3U; valid && index <= directory_length; index++) {+ for (size_t index = root_length; valid && index <= directory_length; index++) {if (index < directory_length && path[index] != L'\\')continue;wchar_t saved = path[index];diff --git a/src/main.c b/src/main.cindex d76546993..d269957a0 100644--- a/src/main.c+++ b/src/main.c@@ -74,6 +74,7 @@ enum {#include <stdatomic.h>#ifndef _WIN32#include <fcntl.h>+#include <sys/stat.h>#include <sys/wait.h>#include <unistd.h>#endif@@ -1315,6 +1316,11 @@ int main(int argc, char **argv) {(void)fprintf(stderr, "codebase-memory-mcp: invalid internal process arguments\n");return EXIT_FAILURE;}+#ifndef _WIN32+ if (role == CBM_DAEMON_PROCESS_DAEMON) {+ (void)umask(077);+ }+#endifcbm_cli_set_version(CBM_VERSION);cbm_profile_init();diff --git a/tests/test_daemon_bootstrap.c b/tests/test_daemon_bootstrap.cindex a6369a321..dbd90ce4f 100644--- a/tests/test_daemon_bootstrap.c+++ b/tests/test_daemon_bootstrap.c@@ -650,6 +650,35 @@ TEST(daemon_bootstrap_concurrent_first_clients_spawn_one_daemon) {PASS();}+#ifdef __APPLE__+/* RED: the old double-fork returned success before its grandchild attempted+ * posix_spawn, hiding an immediate launch error behind the full timeout. */+TEST(daemon_bootstrap_darwin_launch_failure_is_synchronous) {+ bootstrap_endpoint_fixture_t fixture;+ ASSERT_TRUE(bootstrap_endpoint_fixture_start(&fixture, "darwin-missing"));+ cbm_daemon_build_identity_t identity = bootstrap_identity("2.4.0", BOOTSTRAP_BUILD_A);+ char missing[BOOTSTRAP_TEST_PATH_CAP];+ int written = snprintf(missing, sizeof(missing), "%s/definitely-missing-cbm", fixture.parent);+ ASSERT(written > 0 && written < (int)sizeof(missing));+ cbm_daemon_bootstrap_config_t config = {+ .role = CBM_DAEMON_PROCESS_MCP_CLIENT,+ .endpoint = fixture.endpoint,+ .identity = &identity,+ .executable_path = missing,+ .connect_timeout_ms = 1,+ .startup_timeout_ms = BOOTSTRAP_TEST_TIMEOUT_MS,+ };+ cbm_daemon_bootstrap_result_t result;+ uint64_t started = cbm_now_ms();+ ASSERT_EQ(cbm_daemon_bootstrap_execute(&config, &result), CBM_DAEMON_BOOTSTRAP_FAILED);+ uint64_t elapsed = cbm_now_ms() - started;+ ASSERT_FALSE(result.daemon_spawned);+ ASSERT(elapsed < BOOTSTRAP_TEST_TIMEOUT_MS / 2U);+ bootstrap_endpoint_fixture_finish(&fixture);+ PASS();+}+#endif+SUITE(daemon_bootstrap) {RUN_TEST(daemon_bootstrap_classifies_default_and_ui_as_mcp_clients);RUN_TEST(daemon_bootstrap_classifies_stateless_commands_without_client);@@ -670,4 +699,7 @@ SUITE(daemon_bootstrap) {RUN_TEST(daemon_bootstrap_reserved_then_absent_spawns_replacement);RUN_TEST(daemon_bootstrap_rejected_connect_is_reserved_and_never_unavailable);RUN_TEST(daemon_bootstrap_concurrent_first_clients_spawn_one_daemon);+#ifdef __APPLE__+ RUN_TEST(daemon_bootstrap_darwin_launch_failure_is_synchronous);+#endif}diff --git a/tests/test_windows_bundle_contract.sh b/tests/test_windows_bundle_contract.shindex d85e21978..4839e4eda 100644--- a/tests/test_windows_bundle_contract.sh+++ b/tests/test_windows_bundle_contract.sh@@ -327,12 +327,42 @@ require("test_cli_activation_helper.py" not in windows_test_driver,"scripts/test-windows.ps1 must not run the legacy transient activation-helper test",)+require(+ all(+ needle in windows_test_driver+ for needle in (+ 'Copy-Item -LiteralPath $launcherBin -Destination $guardBin',+ 'Copy-Item -LiteralPath $bin -Destination $guardPayload',+ '& $py $t $guardBin',+ '& $py $t $guardBin $guardPayload $abiMismatchLauncher',+ )+ ),+ "ordinary native Windows guards must execute a staged launcher/payload release pair",+)+require(+ windows_test_driver.count("| Out-Host") >= 3+ and windows_test_driver.count("$buildExit = $LASTEXITCODE") >= 3,+ "Windows build helpers must not leak compiler output into returned artifact paths",+)+require(+ '$code -eq 1 -or $t -eq "tests\\windows\\test_windows_launcher.py"'+ in windows_test_driver,+ "the permanent-launcher guard must fail instead of skip on driver/precondition errors",+)# Launcher supervision has two distinct failure directions: killing the# launcher must kill its payload job, and killing only the launcher's immediate# parent must terminate the launcher plus every descendant. Require the native# test to invoke both probes, not merely define helpers that never run.windows_launcher_test = read("tests/windows/test_windows_launcher.py")+unsafe_acl_test = windows_launcher_test[+ windows_launcher_test.find("def assert_untrusted_ancestor_acl_rejected(") :+ windows_launcher_test.find("\ndef process_entries()")+]+require(+ unsafe_acl_test.count('(extended_launcher, "extended DOS")') >= 2,+ "native Windows coverage must reject unsafe ancestor ACLs through extended DOS paths",+)require(windows_launcher_test.count("assert_launcher_death_contains_payload(") >= 2and "server.proc.kill()" in windows_launcher_testdiff --git a/tests/windows/test_windows_launcher.py b/tests/windows/test_windows_launcher.pyindex 9adc86b48..d9834e864 100644--- a/tests/windows/test_windows_launcher.py+++ b/tests/windows/test_windows_launcher.py@@ -335,6 +335,13 @@ def assert_untrusted_ancestor_acl_rejected(run([launcher, "--version"], env).returncode == 0,"portable launcher ACL control failed before the unsafe ACE was added",)+ extended_launcher = "\\\\?\\" + str(launcher.resolve())+ extended_result = run([extended_launcher, "--version"], env)+ require(+ extended_result.returncode == 0,+ "launcher rejected its documented extended DOS module path: %s"+ % output_text(extended_result)[-600:],+ )grant = run(["icacls", unsafe_ancestor, "/grant", "*S-1-1-0:(M)"], env@@ -345,19 +352,31 @@ def assert_untrusted_ancestor_acl_rejected(% output_text(grant)[-600:],)try:- result = run([launcher, "--version"], env)- diagnostic = output_text(result).lower()- require(- result.returncode != 0,- "launcher accepted an ancestor granting cross-account modify access",- )- require(- any(- word in diagnostic- for word in ("unsafe", "security", "ownership", "access", "resolve")- ),- "unsafe ancestor ACL refusal was not explicit",- )+ for candidate, spelling in (+ (launcher, "normal"),+ (extended_launcher, "extended DOS"),+ ):+ result = run([candidate, "--version"], env)+ diagnostic = output_text(result).lower()+ require(+ result.returncode != 0,+ "%s launcher path accepted an ancestor granting cross-account modify access"+ % spelling,+ )+ require(+ any(+ word in diagnostic+ for word in (+ "unsafe",+ "security",+ "ownership",+ "access",+ "resolve",+ )+ ),+ "%s launcher path unsafe-ancestor refusal was not explicit"+ % spelling,+ )finally:remove = run(["icacls", unsafe_ancestor, "/remove:g", "*S-1-1-0"], env@@ -366,10 +385,15 @@ def assert_untrusted_ancestor_acl_rejected(remove.returncode == 0,"could not remove native Everyone-modify ancestor fixture",)- require(- run([launcher, "--version"], env).returncode == 0,- "launcher did not recover after unsafe ancestor ACE removal",- )+ for candidate, spelling in (+ (launcher, "normal"),+ (extended_launcher, "extended DOS"),+ ):+ require(+ run([candidate, "--version"], env).returncode == 0,+ "%s launcher path did not recover after unsafe ancestor ACE removal"+ % spelling,+ )print("PASS: launcher rejected an untrusted mutation ACE on an ancestor")