Skip to content

Commit 34f9ad1

Browse files
committed
fix(daemon,win): CI-green fixes and a daemon-stability guard
Fixes surfaced while bringing the shared-coordination-daemon branch green across macOS, the Linux containers, and the real Windows-ARM64 VM, plus a new stability guard that caught one of them. - daemon(win): the CLI teardown transition latched a failed release as permanent, but a Windows participant-state release must briefly try-hold the shared startup/legacy gates and legitimately collides with a concurrent one-shot's teardown; the release is retriable by contract (it always retains the transition), so parallel one-shot commands no longer report "CLI coordination cleanup failed" despite succeeding. Found by the new stability guard's churn section. - cli/main(win): install/update/uninstall and the Augment hook-script removal derive the managed launcher's identity from its plain drive-form path (cli_windows_plain_utf8), not the \\?\ extended-length form, so agent-config ownership matches on Windows and uninstall no longer leaves the MCP entry or owned hook scripts behind. - security: the `daemon start --open` browser launch is now shell-free (ShellExecuteW on Windows, cbm_exec_no_shell elsewhere) instead of system(); the CORS origin check spells out its two literal loopback URLs so the static URL audit sees a complete value. Both clear the Layer-1 allow-list audit. - coordination: version-cohort lock retries now sleep a per-process jittered interval — fixed-period retries can phase-lock two participants so one starves. The activation-quiesce test's observation window now covers worst-case candidate staging (three tamper-defense hashes over a ~1 GB sanitizer binary exceed the old 30 s budget on container I/O). - smoke/soak: the agent-config smoke matches Windows config paths through their escaped-backslash quoted form; the soak parser skips the update-available banner before the JSON summary and gained a one-shot CLI admission-churn phase inside the RSS/FD leak window. The build-dir safety fixture creates a real symlink/junction (MSYS2 ln -s otherwise deep-copies) so its traversal-refusal contract is genuinely exercised, and the symlinked-agent-roots test demotes its planted links to an unprivileged owner when run as root so the refusal is really tested. - tests(win): a new daemon-stability guard exercises the parameter surface, hook fail-open with its rate-limited notice, start-twice and occupied-port handling, busy-stop refusal against a live MCP session, kill -9 crash recovery, and sequential/parallel one-shot churn. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 30550fb commit 34f9ad1

10 files changed

Lines changed: 579 additions & 51 deletions

File tree

‎scripts/smoke-test.sh‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,20 @@ path_match() {
11091109
return 1
11101110
}
11111111

1112+
# A Windows path lands in a YAML/TOML config as a double-quoted scalar with
1113+
# ESCAPED backslashes ("C:\\Users\\..."), so a raw grep for the msys-form
1114+
# $SELF_PATH can never match it. Unquote, unescape, normalize separators,
1115+
# then path_match.
1116+
quoted_path_value_matches() {
1117+
local value="${1%$'\r'}"
1118+
local expected="$2"
1119+
value="${value#\"}"
1120+
value="${value%\"}"
1121+
value="${value//\\\\/\\}"
1122+
value="${value//\\//}"
1123+
[ -n "$value" ] && path_match "$value" "$expected"
1124+
}
1125+
11121126
json_instructions_contain_path() {
11131127
local config="$1"
11141128
local expected="$2"
@@ -1554,9 +1568,11 @@ fi
15541568
echo "OK 8w-ii: Kiro MCP + steering + isolated exact-tool graph agent"
15551569

15561570
# 8x: Hermes Agent YAML MCP mapping
1571+
HERMES_CMD=$(sed -n '/^ codebase-memory-mcp:/{n;s/^ *command: *//p;}' \
1572+
"$FAKE_HOME/.hermes/config.yaml" 2>/dev/null | head -1)
15571573
if ! grep -q '^mcp_servers:' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
15581574
! grep -q '^ codebase-memory-mcp:' "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null ||
1559-
! grep -Fq "$SELF_PATH" "$FAKE_HOME/.hermes/config.yaml" 2>/dev/null; then
1575+
! quoted_path_value_matches "$HERMES_CMD" "$SELF_PATH"; then
15601576
echo "FAIL 8x: Hermes MCP mapping missing or malformed"
15611577
exit 1
15621578
fi
@@ -1728,9 +1744,11 @@ if [[ "$BINARY" == *.exe ]]; then
17281744
else
17291745
GOOSE_CFG="$FAKE_HOME/.config/goose/config.yaml"
17301746
fi
1747+
GOOSE_CMD=$(sed -n '/^ codebase-memory-mcp:/,/^ [^ ]/{s/^ *cmd: *//p;}' \
1748+
"$GOOSE_CFG" 2>/dev/null | head -1)
17311749
if ! grep -q '^extensions:' "$GOOSE_CFG" 2>/dev/null ||
17321750
! grep -q '^ codebase-memory-mcp:' "$GOOSE_CFG" 2>/dev/null ||
1733-
! grep -Fq "$SELF_PATH" "$GOOSE_CFG" 2>/dev/null; then
1751+
! quoted_path_value_matches "$GOOSE_CMD" "$SELF_PATH"; then
17341752
echo "FAIL 8ae: Goose extension missing or malformed"
17351753
exit 1
17361754
fi
@@ -1743,9 +1761,10 @@ fi
17431761
echo "OK 8ae-i: Goose durable hints"
17441762

17451763
# 8af: Mistral Vibe TOML array table
1764+
VIBE_CMD=$(sed -n 's/^command *= *//p' "$FAKE_HOME/.vibe/config.toml" 2>/dev/null | head -1)
17461765
if ! grep -q '^\[\[mcp_servers\]\]' "$FAKE_HOME/.vibe/config.toml" 2>/dev/null ||
17471766
! grep -q '^name = "codebase-memory-mcp"' "$FAKE_HOME/.vibe/config.toml" 2>/dev/null ||
1748-
! grep -Fq "$SELF_PATH" "$FAKE_HOME/.vibe/config.toml" 2>/dev/null; then
1767+
! quoted_path_value_matches "$VIBE_CMD" "$SELF_PATH"; then
17491768
echo "FAIL 8af: Mistral Vibe MCP table missing or malformed"
17501769
exit 1
17511770
fi

‎scripts/soak-test.sh‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,12 @@ try:
294294
project = ""
295295
for item in content:
296296
if isinstance(item, dict) and item.get("type") == "text":
297-
payload = json.loads(item.get("text", ""))
297+
# The summary JSON may be preceded by plain-text banner items
298+
# (update-available notice); skip anything that is not JSON.
299+
try:
300+
payload = json.loads(item.get("text", ""))
301+
except ValueError:
302+
continue
298303
candidate = payload.get("project") if isinstance(payload, dict) else None
299304
if isinstance(candidate, str) and candidate:
300305
project = candidate
@@ -575,6 +580,32 @@ else
575580
echo "SKIP: idle daemon CPU is unavailable across the Windows PID boundary"
576581
fi
577582

583+
# ── Phase 4b: one-shot CLI admission churn ───────────────────────
584+
# Every `cli` one-shot is a complete daemon client cycle (connect → commit →
585+
# execute → close-intent → drain) against the SAME daemon the metrics sampler
586+
# is watching. The long-lived MCP session above never exercises that path, so
587+
# a per-admission leak in the accept/worker-finish cycle would be invisible
588+
# without this churn — it lands in the same RSS/FD analysis below.
589+
590+
echo "--- Phase 4b: CLI one-shot admission churn ---"
591+
CHURN_CYCLES=${SOAK_CLI_CHURN_CYCLES:-40}
592+
CHURN_FAILS=0
593+
churn_index=0
594+
while [ "$churn_index" -lt "$CHURN_CYCLES" ]; do
595+
if ! CBM_CACHE_DIR="$SOAK_CACHE_DIR_VALUE" "$BINARY" cli list_projects '{}' \
596+
>/dev/null 2>>"$RESULTS_DIR/cli-churn-stderr.log"; then
597+
CHURN_FAILS=$((CHURN_FAILS + 1))
598+
fi
599+
churn_index=$((churn_index + 1))
600+
done
601+
if [ "$CHURN_FAILS" -gt 0 ]; then
602+
echo "FAIL: $CHURN_FAILS of $CHURN_CYCLES one-shot CLI churn cycles failed"
603+
PASS=false
604+
else
605+
echo "OK: $CHURN_CYCLES one-shot CLI churn cycles recycled the live daemon"
606+
fi
607+
collect_snapshot
608+
578609
# ── Phase 5: Crash recovery test ────────────────────────────────
579610
# Skipped in query-leak mode: crash recovery re-indexes (Phase 5 calls
580611
# index_repository), which triggers cbm_mem_collect and would mask the #581
@@ -705,7 +736,8 @@ fi
705736

706737
# Check 3: Idle daemon CPU (where the PID is host-addressable)
707738
if [ -n "$IDLE_CPU" ]; then
708-
IDLE_INT=$(echo "$IDLE_CPU" | cut -d. -f1)
739+
# ps %cpu may carry a locale decimal comma; strip either separator.
740+
IDLE_INT=$(echo "$IDLE_CPU" | cut -d. -f1 | cut -d, -f1)
709741
echo "Idle daemon CPU: ${IDLE_CPU}%" | tee -a "$SUMMARY"
710742
if [ "${IDLE_INT:-0}" -gt 5 ] 2>/dev/null; then
711743
echo "FAIL: idle daemon CPU ${IDLE_CPU}% > 5%" | tee -a "$SUMMARY"

‎scripts/test-windows.ps1‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* test_hook_augment.py guards #618 (fixed by #619)
1919
* test_ui_drive_listing.py guards #548 (roots field)
2020
* test_cli_non_ascii_arg.py guards #423/#20 (wide-argv main())
21+
* test_daemon_stability.py guards the daemon parameter
22+
surface, crash recovery, busy-stop refusal, and churn
2123
* test_windows_launcher.py guards the permanent launcher,
2224
managed layout, portable refusal, and crash containment
2325
@@ -196,6 +198,7 @@ $guards = @(
196198
"tests\windows\test_non_ascii_path.py",
197199
"tests\windows\test_non_ascii_cache_dump.py",
198200
"tests\windows\test_daemon_lifecycle.py",
201+
"tests\windows\test_daemon_stability.py",
199202
"tests\windows\test_hook_augment.py",
200203
"tests\windows\test_ui_drive_listing.py",
201204
"tests\windows\test_cli_non_ascii_arg.py",

‎src/cli/cli.c‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8114,7 +8114,7 @@ static void cbm_agent_installed_binary_path(const char *home, char *binary_path,
81148114
size_t binary_path_size) {
81158115
#ifdef _WIN32
81168116
char *managed = g_windows_launcher_context.present && g_windows_launcher_context.managed
8117-
? cbm_wide_to_utf8(g_windows_launcher_context.canonical_launcher_path)
8117+
? cli_windows_plain_utf8(g_windows_launcher_context.canonical_launcher_path)
81188118
: NULL;
81198119
if (managed) {
81208120
(void)snprintf(binary_path, binary_path_size, "%s", managed);
@@ -11631,11 +11631,10 @@ static void uninstall_additional_agents(const cbm_detected_agents_t *agents, con
1163111631
AUGMENT_SESSION_SCRIPT);
1163211632
snprintf(coverage_hp, sizeof(coverage_hp), "%s/.augment/hooks/%s", home,
1163311633
AUGMENT_COVERAGE_SCRIPT);
11634-
#ifdef _WIN32
11635-
snprintf(binary_path, sizeof(binary_path), "%s/.local/bin/codebase-memory-mcp.exe", home);
11636-
#else
11637-
snprintf(binary_path, sizeof(binary_path), "%s/.local/bin/codebase-memory-mcp", home);
11638-
#endif
11634+
/* The owned-document match must rebuild the scripts with the exact
11635+
* binary path the install embedded — the managed canonical plain form
11636+
* on Windows, not a hand-assembled default. */
11637+
cbm_agent_installed_binary_path(home, binary_path, sizeof(binary_path));
1163911638
uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Augment/Auggie", cp, ip}, dry_run,
1164011639
cbm_remove_editor_mcp_owned);
1164111640
uninstall_tiered_agent_profiles(
@@ -12047,7 +12046,8 @@ static int cli_windows_managed_uninstall(const char *home, bool dry_run) {
1204712046
printf("Indexes kept.\n");
1204812047
}
1204912048
}
12050-
char *canonical_utf8 = cbm_wide_to_utf8(g_windows_launcher_context.canonical_launcher_path);
12049+
char *canonical_utf8 =
12050+
cli_windows_plain_utf8(g_windows_launcher_context.canonical_launcher_path);
1205112051
if (!canonical_utf8) {
1205212052
return CLI_TRUE;
1205312053
}
@@ -12368,8 +12368,9 @@ static int cli_windows_extract_and_activate_update(const char *archive_path, con
1236812368
g_windows_launcher_context.canonical_launcher_path, previous_launcher_backing,
1236912369
CBM_WINDOWS_LAUNCHER_PATH_CAP, backing_error, sizeof(backing_error));
1237012370
char *canonical_utf8 =
12371-
current_compatible ? cbm_wide_to_utf8(g_windows_launcher_context.canonical_launcher_path)
12372-
: NULL;
12371+
current_compatible
12372+
? cli_windows_plain_utf8(g_windows_launcher_context.canonical_launcher_path)
12373+
: NULL;
1237312374
if (!canonical_utf8) {
1237412375
cbm_windows_release_pair_free(&pair);
1237512376
(void)fprintf(stderr,
@@ -12979,7 +12980,8 @@ int cbm_cmd_update(int argc, char **argv) {
1297912980
if (dry_run) {
1298012981
printf("\n(dry-run — skipping download, extraction, and binary replacement)\n");
1298112982
#ifdef _WIN32
12982-
char *dry_run_target = cbm_wide_to_utf8(g_windows_launcher_context.canonical_launcher_path);
12983+
char *dry_run_target =
12984+
cli_windows_plain_utf8(g_windows_launcher_context.canonical_launcher_path);
1298312985
printf(" target: %s\n", dry_run_target ? dry_run_target : "(managed launcher)");
1298412986
free(dry_run_target);
1298512987
#else

‎src/daemon/version_cohort.c‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ static uint64_t version_cohort_deadline_after(uint32_t timeout_ms) {
8383
return now > UINT64_MAX - timeout_ms ? UINT64_MAX : now + timeout_ms;
8484
}
8585

86+
/* flock's LOCK_NB retries never queue in the kernel, so fairness comes only
87+
* from the retry schedule. Two participants retrying with the SAME fixed
88+
* period can phase-lock — every try landing inside the peer's brief hold
89+
* window — starving an EX acquisition until one side's budget expires. A
90+
* per-process, time-scattered jitter decorrelates the schedules. */
91+
static void version_cohort_retry_sleep(void) {
92+
uint64_t mix = (cbm_now_ms() + version_cohort_current_pid()) * 2654435761ULL;
93+
cbm_usleep(VERSION_COHORT_RETRY_US / 2U + (uint32_t)(mix % VERSION_COHORT_RETRY_US));
94+
}
95+
8696
static cbm_private_file_lock_status_t version_cohort_lock_release_until(
8797
cbm_private_file_lock_t **lock_io, uint64_t deadline_ms) {
8898
cbm_private_file_lock_status_t result = CBM_PRIVATE_FILE_LOCK_OK;
@@ -100,7 +110,7 @@ static cbm_private_file_lock_status_t version_cohort_lock_release_until(
100110
if (cbm_now_ms() >= deadline_ms) {
101111
return result == CBM_PRIVATE_FILE_LOCK_OK ? CBM_PRIVATE_FILE_LOCK_IO : result;
102112
}
103-
cbm_usleep(VERSION_COHORT_RETRY_US);
113+
version_cohort_retry_sleep();
104114
}
105115
return result;
106116
}
@@ -132,7 +142,7 @@ static void version_cohort_startup_lock_release_complete(cbm_daemon_ipc_startup_
132142
if (cbm_now_ms() >= deadline) {
133143
version_cohort_cleanup_fail_stop("startup_lock_cleanup");
134144
}
135-
cbm_usleep(VERSION_COHORT_RETRY_US);
145+
version_cohort_retry_sleep();
136146
}
137147
}
138148
#endif
@@ -249,7 +259,7 @@ static cbm_private_file_lock_status_t version_cohort_lock_until(
249259
(deadline_ms != UINT64_MAX && cbm_now_ms() >= deadline_ms)) {
250260
return status;
251261
}
252-
cbm_usleep(VERSION_COHORT_RETRY_US);
262+
version_cohort_retry_sleep();
253263
}
254264
}
255265

‎src/main.c‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,21 +1163,23 @@ static bool main_project_lock_manager_close(cbm_project_lock_manager_t **manager
11631163
}
11641164

11651165
static bool main_local_transition_close(cbm_daemon_ipc_local_transition_t **transition) {
1166-
bool ok = true;
11671166
uint64_t deadline = main_deadline_after(MAIN_COORDINATION_CLEANUP_MS);
11681167
while (transition && *transition) {
1169-
bool released = cbm_daemon_ipc_local_transition_release(transition);
1170-
if (!released) {
1171-
ok = false;
1172-
}
1168+
/* A failed release always RETAINS the transition and is retriable by
1169+
* contract: the Windows release transition must briefly try-hold the
1170+
* shared startup-v2/legacy gates, so concurrent one-shot teardowns
1171+
* legitimately collide and succeed on retry. Success consumes the
1172+
* transition; only never-finishing cleanup is a failure, and the
1173+
* deadline escalation below owns that. */
1174+
(void)cbm_daemon_ipc_local_transition_release(transition);
11731175
if (*transition) {
11741176
if (cbm_now_ms() >= deadline) {
11751177
main_coordination_cleanup_fail_stop("local_transition_cleanup");
11761178
}
11771179
cbm_usleep(1000);
11781180
}
11791181
}
1180-
return ok;
1182+
return true;
11811183
}
11821184

11831185
static bool main_session_context(const char *preferred_root, char root_out[MAIN_PATH_CAP],
@@ -1517,16 +1519,20 @@ static void main_daemon_ctl_open_browser(int port) {
15171519
char url[64];
15181520
(void)snprintf(url, sizeof(url), "http://127.0.0.1:%d", port);
15191521
#if defined(_WIN32)
1520-
char command[96];
1521-
(void)snprintf(command, sizeof(command), "start \"\" %s", url);
1522+
/* ShellExecuteW resolves the http protocol association directly — no
1523+
* command shell interprets the argument. Values > 32 signal success. */
1524+
wchar_t *wide_url = cbm_utf8_to_wide(url);
1525+
bool opened =
1526+
wide_url && (INT_PTR)ShellExecuteW(NULL, L"open", wide_url, NULL, NULL, SW_SHOWNORMAL) > 32;
1527+
free(wide_url);
15221528
#elif defined(__APPLE__)
1523-
char command[96];
1524-
(void)snprintf(command, sizeof(command), "open %s", url);
1529+
const char *open_argv[] = {"open", url, NULL};
1530+
bool opened = cbm_exec_no_shell(open_argv) == 0;
15251531
#else
1526-
char command[96];
1527-
(void)snprintf(command, sizeof(command), "xdg-open %s >/dev/null 2>&1", url);
1532+
const char *open_argv[] = {"xdg-open", url, NULL};
1533+
bool opened = cbm_exec_no_shell(open_argv) == 0;
15281534
#endif
1529-
if (system(command) != 0) {
1535+
if (!opened) {
15301536
(void)fprintf(stderr, "hint: could not open a browser automatically; visit %s\n", url);
15311537
}
15321538
}

‎src/ui/http_server.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ static bool origin_is_same_server(const char *origin, int port) {
8383
}
8484

8585
static bool origin_matches_host(const char *origin, const char *host, int port) {
86-
const char *hostname = strncmp(host, "localhost", 9) == 0 ? "localhost" : "127.0.0.1";
86+
/* Two literal loopback forms only — spelled out so the static URL audit
87+
* sees the complete URL each branch can produce. */
8788
char expected[128];
88-
int length = snprintf(expected, sizeof(expected), "http://%s:%d", hostname, port);
89+
int length = strncmp(host, "localhost", 9) == 0
90+
? snprintf(expected, sizeof(expected), "http://localhost:%d", port)
91+
: snprintf(expected, sizeof(expected), "http://127.0.0.1:%d", port);
8992
return length > 0 && (size_t)length < sizeof(expected) && strcmp(origin, expected) == 0;
9093
}
9194

‎tests/test_build_dir_safety.sh‎

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,60 @@ for path in \
3333
fi
3434
done
3535

36+
# Create a real directory link: a native symlink, or an NTFS junction on
37+
# Windows (MSYS reports junctions as symlinks). MSYS2's default `ln -s`
38+
# silently DEEP-COPIES the target, which would turn these traversal fixtures
39+
# into vacuous copies that the validator rightly accepts. Returns nonzero
40+
# when this environment cannot create a real link at all — the traversal
41+
# scenario then cannot exist, and the caller skips instead of asserting
42+
# against a copy.
43+
make_real_dir_link() {
44+
local target="$1" link="$2"
45+
if MSYS=winsymlinks:nativestrict ln -s -- "$target" "$link" 2>/dev/null &&
46+
[ -L "$link" ]; then
47+
return 0
48+
fi
49+
rm -rf -- "$link"
50+
case "$(uname -s)" in
51+
MINGW* | MSYS* | CYGWIN*)
52+
cmd //c "mklink /J \"$(cygpath -w "$link")\" \"$(cygpath -w "$target")\"" \
53+
>/dev/null 2>&1 || true
54+
;;
55+
esac
56+
[ -L "$link" ]
57+
}
58+
3659
# Lexical containment is not enough: an attacker-controlled or accidental
3760
# build/ symlink would make ROOT/build/c traverse outside the repository.
3861
symlink_fixture="$(mktemp -d "${TMPDIR:-/tmp}/cbm-build-dir-symlink.XXXXXX")"
3962
trap 'rm -rf -- "$symlink_fixture"' EXIT
4063
mkdir -p "$symlink_fixture/repo" "$symlink_fixture/outside"
41-
ln -s "$symlink_fixture/outside" "$symlink_fixture/repo/build"
42-
if (
43-
cd "$symlink_fixture/repo"
44-
cbm_require_safe_build_dir build/c "$symlink_fixture/repo"
45-
); then
46-
echo "FAIL: BUILD_DIR accepted a symlinked build/ ancestor" >&2
47-
exit 1
64+
if make_real_dir_link "$symlink_fixture/outside" "$symlink_fixture/repo/build"; then
65+
if (
66+
cd "$symlink_fixture/repo"
67+
cbm_require_safe_build_dir build/c "$symlink_fixture/repo"
68+
); then
69+
echo "FAIL: BUILD_DIR accepted a symlinked build/ ancestor" >&2
70+
exit 1
71+
fi
72+
else
73+
echo "SKIP: no real symlink/junction support here; ancestor-traversal fixture not exercisable"
4874
fi
4975

5076
mkdir -p "$symlink_fixture/safe-repo/build" "$symlink_fixture/final-target"
5177
printf 'keep\n' >"$symlink_fixture/final-target/sentinel"
52-
ln -s "$symlink_fixture/final-target" "$symlink_fixture/safe-repo/build/c"
53-
if ! cbm_remove_build_dir "$symlink_fixture/safe-repo" build/c; then
54-
echo "FAIL: safe removal rejected a final-component symlink" >&2
55-
exit 1
56-
fi
57-
if [ -e "$symlink_fixture/safe-repo/build/c" ] ||
58-
[ ! -f "$symlink_fixture/final-target/sentinel" ]; then
59-
echo "FAIL: final-component symlink removal followed the link" >&2
60-
exit 1
78+
if make_real_dir_link "$symlink_fixture/final-target" "$symlink_fixture/safe-repo/build/c"; then
79+
if ! cbm_remove_build_dir "$symlink_fixture/safe-repo" build/c; then
80+
echo "FAIL: safe removal rejected a final-component symlink" >&2
81+
exit 1
82+
fi
83+
if [ -e "$symlink_fixture/safe-repo/build/c" ] ||
84+
[ ! -f "$symlink_fixture/final-target/sentinel" ]; then
85+
echo "FAIL: final-component symlink removal followed the link" >&2
86+
exit 1
87+
fi
88+
else
89+
echo "SKIP: no real symlink/junction support here; final-component fixture not exercisable"
6190
fi
6291
mkdir -p "$symlink_fixture/safe-repo/build/ordinary"
6392
printf 'remove\n' >"$symlink_fixture/safe-repo/build/ordinary/artifact"

0 commit comments

Comments
 (0)