Skip to content

Windows LPAC: compiler-run owner.lock uses a canonical physical path instead of the granted workspace spelling #1048

Done

Description

@dreamyloong2005

Duplicate check (2026-12-06): No exact duplicate found in the documented search scope; scoped new-issue candidate

Live-source check: the owning current-main source still contains the relevant pattern. This is a static check, not a new runtime reproduction of current main. Search results are bounded and do not prove that no duplicate exists.

Summary

In mcpp 2026.12.4.1, locate_runs() correctly computes a canonical output
identity, but also canonicalizes the workspace path used for compiler-run state
I/O. In a Windows LPAC harness where the granted workspace spelling is
Z:/work/workspace and its physical D:/<private-root>/... spelling is not an
allowed preopen route, the real owner.lock acquisition fails.

This specific cause is confirmed by actual rebuilt-mcpp A/B/A, not only by
source inspection or an official-binary-versus-different-local-build comparison.
Keeping the operational work spelling permits the real lock acquisition;
restoring the original logic and rebuilding restores the failure. Locks and
compiler-run management remain enabled throughout.

Environment

  • Windows x64, restricted LPAC build host; no network access or expanded grants.
  • mcpp release source pinned to
    332fea767afbb04207bb3f2a1806b64be5da0ca4
    (2026.12.4.1). The official Windows release also exhibits the target failure.
  • Runtime fixture toolchain: LLVM 22.1.8, Windows MSVC ABI; bundled xlings
    2026.12.5.2. The C++26 fixture is freestanding and includes no STL or CRT.
  • Local causal variants were built with the same bootstrap mcpp, LLVM 23.1.3,
    system MSVC/SDK paths, --profile ci --cache local --jobs 2, and saved
    dependency resolution: mcpplibs.os 0.4.9, openkal 0.26.2,
    openkal-windows 0.23.3.
  • The local dependency closure is not claimed identical to the official
    binary's
    . The official release was reported to use openkal-windows 0.23.2.
    The useful control is the locally rebuilt original logic actually reproducing
    the same failure before changing one behavior.

Expected and actual behavior

Expected: use the permitted workspace spelling for generation-directory and
lock-file I/O, while retaining canonical output identity for slot identity,
comparison and hashing. A controller must acquire the real exclusive owner lock
before admitting managed compiler work.

Actual: the allowed Z: workspace becomes a physical D: operation path:

cannot lock the compiler-run owner: locking D:/<private-root>/<sandbox>/work/workspace/.mcpp/compiler-runs/<configuration>/run-<identity>/owner.lock: beneath no directory this program was given: not found

The observed preopen table contains the granted Z: routes, not the physical
ancestor. The previous compiler-executable launch issue is a different stage:
LLVM version/fetch can succeed before this owner-lock failure.

Reproduction

Harness requirement: this is not reproduced by merely running mcpp in an
ordinary unrestricted terminal. It requires the existing LPAC harness's drive
alias, process token, preopen setup and private runtime layout. A reviewed,
sanitized harness/fixture subset must accompany an upstream submission; these
instructions do not claim a portable standalone LPAC launcher is attached.

  1. In a fresh sandbox, expose a workspace at Z:/work/workspace, private home at
    Z:/work/home, LLVM at Z:/bin/llvm, and a prepared offline bundle at
    Z:/bin/bundle. Do not add the physical ancestor as a permitted route.

  2. Use the recorded freestanding C++26 pack-indexing fixture. Its relevant
    settings are standard = "c++26", an empty local MSVC toolset layout, and
    explicit -nostdlib -Wl,/entry:mainCRTStartup -Wl,/subsystem:console link flags.
    The failing lock occurs before the compiler/linker can exercise those flags.

  3. Set MCPP_HOME=Z:/work/home/.mcpp, MCPP_OFFLINE=1, and
    MCPP_TOOLCHAIN=path:Z:/bin/llvm; put the mounted LLVM/mcpp bins on PATH.
    The recorded reduced harness prepares only its own private AppContainer Temp
    directory. That diagnostic setup is fixed across variants, not a proposed
    global Temp/permission workaround.

  4. With cwd Z:/work/workspace, run:

    mcpp fetch --from Z:/bin/bundle
    mcpp build --profile release
    

    Fetch succeeds; build reaches the owner-lock error above. The unchanged
    original integration recipe also reaches it via
    mcpp pack --profile release --pkg-format dir.

  5. For the causal control, stage three actual source builds in fresh sandboxes:
    A = original behavior; B = only the operational-work change below; A2 =
    restored original behavior and a verified fresh rebuild. Use identical
    diagnostic instrumentation on all three, logging the supplied/canonical/work
    paths, preopens, attempted lock and successful return from real lock::acquire.

Configure-only is a negative control, not build acceptance. Earlier provider
preparation failures are excluded from the owner-lock reproduction.

Source and minimal change

The single functional change tested in B is:

-    at.work = std::filesystem::weakly_canonical(
-        target.filename() == "target" ? target.parent_path() : spelled.parent_path(), ec);
+    at.work = (target.filename() == "target" ? target.parent_path() : spelled.parent_path()).lexically_normal();

The production version should also remove the now-stale error check for that
operation. spelled is already absolute and lexically normalized. Do not
remove at.canonical, change slot identity or perform arbitrary D: to Z:
string substitution. No blanket canonical-to-lexical transaction rewrite is
needed for this finding.

Observed red/green evidence and limits

Actual rebuilt variant Operational work / lock spelling Target verdict Remaining result
A, original behavior Physical D: Owner lock fails; 8.266 s Registration not reached
B, only work spelling retained Granted Z: Real owner lock acquired; 7.906 s Build still fails later at registration runtime path
A2, original behavior restored and rebuilt Physical D: Same owner-lock failure; 8.031 s Registration not reached

Across the recorded 1,257 runtime inputs, non-mcpp payloads and runner/helper
hashes match after staging-location normalization. In the 5,501-file B/A2
source/private-package/index comparison, only the target source file differs;
saved dependency resolutions match and the A2 build leaves recorded inputs
unchanged. External build LLVM/SDK bytes were not included in that snapshot.

An initial attempted A2 incremental build incorrectly reused B because restored
source retained an old mtime. Hash checking caught it; it was not used as A2.
The table uses the subsequent actual rebuilt original executable.

Later, a combined local repair passed all four original Debug/Release × two-home
integration cells, with actual compilation, execution and atomic export. That
is integration regression evidence for the combined repairs, not four more
isolated A/B tests of this one change. The owner-only B is not a full-build pass.

Acceptance and safety boundaries

  • Require a genuine exclusive lock acquisition under the alias, retaining
    compiler-run ownership, capacity accounting, observation and reclamation.
  • Preserve canonical configuration identity and intended state placement beside
    target/, including when target/<triple> points to a disposable cache.
  • Keep original-parent recovery and rejection of foreign, malformed,
    directory-symlink and file-symlink completion certificates. The selected local
    transaction regression cases covering those protections passed; Linux-only
    controls and helper subprocess-driver skips are not counted as successes.
  • Add dedicated same-gate contention across two allowed aliases, multiple-plan
    separation, live-owner cleanup refusal, interrupted recovery and path-spelling
    coverage before claiming those broader cases accepted. They were not proved
    by the owner-lock A/B/A or the combined smoke matrix.
  • No extra grants/ACL widening, disabled locks, unmanaged compiler fallback or
    weakened original assertions. No claim of native macOS/Linux, all-feature or
    official-release acceptance.

Activity

  1. speak-agent commented on Dec 6, 2026

    @speak-agent
    Member

    Fixed in 2026.12.7.1 (#1054). A compiler run's working directory and its owner.lock are opened by the spelling the process was given; the cache key and the output identity use the address with its links followed, and no ancestor is opened by another spelling. The rule is stated in SPEC-020 (docs/specs/paths.md), and a CI check holds every other resolution of a path to its physical spelling at zero. Covered by unit cases of the path module and by e2e cases that build, test and pack through a home named by an alias (the graph and the compile database name only the alias); the Windows runner runs the same cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions