Skip to content

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.

fix(test): qualify build-dir owner with its domain

PETRO YAKOVYSHYN3d613a4c9ff8
diff --git a/scripts/memlab.sh b/scripts/memlab.sh
index c849db5a1..ffe5969f7 100644
--- a/scripts/memlab.sh
+++ b/scripts/memlab.sh
@@ -35,7 +35,13 @@ if [[ "$BINARY" == *.exe ]] && command -v cygpath >/dev/null 2>&1 &&
! command -v winepath >/dev/null 2>&1; then
WIN_ROOT=$(mktemp -d "$(cygpath "$USERPROFILE")/cbm-memlab.XXXXXX")
WIN_ROOT_W="$(cygpath -w "$WIN_ROOT")"
+ # Qualify with the domain: a bare name from coreutils `whoami` resolves
+ # against the machine first, so on a host whose name equals the user's the
+ # grant lands on an empty principal.
ME="$(whoami | tr -d '\r')"
+ if [ -n "${USERDOMAIN:-}" ]; then
+ ME="${USERDOMAIN}\\${ME}"
+ fi
MSYS2_ARG_CONV_EXCL='*' icacls "$WIN_ROOT_W" /reset /Q >/dev/null 2>&1 || true
if ! MSYS2_ARG_CONV_EXCL='*' icacls "$WIN_ROOT_W" /inheritance:r \
/grant:r "${ME}:(OI)(CI)F" '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' \
diff --git a/scripts/run-tests-parallel.sh b/scripts/run-tests-parallel.sh
index 7bd69b1ff..d7f8c0e8c 100644
--- a/scripts/run-tests-parallel.sh
+++ b/scripts/run-tests-parallel.sh
@@ -58,7 +58,16 @@ stamp_windows_build_dir() {
esac
local runner_dir_w me norm_out stamp_out reset_out
runner_dir_w="$(cygpath -w "$(dirname "$RUNNER")")"
+ # Qualify the account with its domain. Git Bash resolves `whoami` to
+ # coreutils, which prints a bare name, and icacls resolves a bare name
+ # against the machine first: on a host whose name equals the user's
+ # (COMPUTERNAME=BUILD, user build) the grant lands on an empty principal
+ # (BUILD\) and, combined with /inheritance:r above, locks this script out
+ # of its own log directory.
me="$(whoami | tr -d '\r')"
+ if [ -n "${USERDOMAIN:-}" ]; then
+ me="${USERDOMAIN}\\${me}"
+ fi
# Normalize FIRST: some runner images stamp EXPLICIT (non-inherited)
# Authenticated-Users ACEs onto the workspace tree, which /inheritance:r
# cannot strip and /grant:r does not touch (it replaces only the granted
diff --git a/scripts/soak-test.sh b/scripts/soak-test.sh
index 1aba4d327..12910bbd1 100755
--- a/scripts/soak-test.sh
+++ b/scripts/soak-test.sh
@@ -77,7 +77,13 @@ mkdir -p "$RESULTS_DIR"
soak_stamp_windows_dir() {
local dir_w me output
dir_w="$(cygpath -w "$1")"
+ # Qualify with the domain: a bare name from coreutils `whoami` resolves
+ # against the machine first, so on a host whose name equals the user's the
+ # grant lands on an empty principal.
me="$(whoami | tr -d '\r')"
+ if [ -n "${USERDOMAIN:-}" ]; then
+ me="${USERDOMAIN}\\${me}"
+ fi
if ! output=$(MSYS2_ARG_CONV_EXCL='*' icacls "$dir_w" /reset /Q 2>&1); then
echo "FAIL: soak DACL normalize failed (dir=$dir_w user=$me)" >&2
printf '%s\n' "$output" >&2