{"record":{"id":"1b5b820dedf9e81c","repo":"abhigyanpatwari/GitNexus","slug":"atomic-overlay-exchange-is-unavailable-on-this-pla","errorCode":null,"errorMessage":"atomic overlay exchange is unavailable on this platform","messagePattern":"atomic overlay exchange is unavailable on this platform","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"eval/workflow_bench/promotion_apply.py","lineNumber":417,"sourceCode":"\n\ndef _same_entry(\n    left: tuple[int, int, int, int, int, int],\n    right: tuple[int, int, int, int, int, int],\n) -> bool:\n    return left[:2] == right[:2]\n\n\n_RENAME_EXCHANGE = 2\n\n\ndef _exchange_at(parent_descriptor: int, left: str, right: str) -> None:\n    \"\"\"Atomically exchange two existing names in one held directory.\"\"\"\n\n    try:\n        renameat2 = ctypes.CDLL(None, use_errno=True).renameat2\n    except AttributeError as exc:\n        raise RuntimeError(\"atomic overlay exchange is unavailable on this platform\") from exc\n    renameat2.argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_uint]\n    renameat2.restype = ctypes.c_int\n    if (\n        renameat2(\n            parent_descriptor,\n            os.fsencode(left),\n            parent_descriptor,\n            os.fsencode(right),\n            _RENAME_EXCHANGE,\n        )\n        == 0\n    ):\n        os.fsync(parent_descriptor)\n        return\n    error = ctypes.get_errno()\n    if error in {errno.ENOSYS, errno.EINVAL, errno.EOPNOTSUPP}:\n        raise RuntimeError(\"atomic overlay exchange is unavailable on this filesystem\")\n    raise OSError(error, os.strerror(error), f\"{left} <-> {right}\")","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/promotion_apply.py#L399-L435","documentation":"Thrown by `_exchange_at` when `ctypes.CDLL(None).renameat2` is missing. The atomic overlay promoter relies on the Linux `renameat2(RENAME_EXCHANGE)` syscall to swap two directory entries in one operation; if the host libc has no `renameat2` symbol (non-Linux OS, or a glibc/kernel older than Linux 3.15), the swap primitive does not exist and the CAS overlay cannot run.","triggerScenarios":"Calling `apply_promoted_overlay()` (or any path that stages and publishes overlay targets) on macOS, Windows, a BSD, a container running an ancient glibc, or any system where libc does not export the `renameat2` symbol. `ctypes.CDLL(None, use_errno=True).renameat2` raises `AttributeError` and is re-raised as this `RuntimeError`.","commonSituations":"Developer runs the workflow bench on a Mac or in CI on a non-Linux runner; a Linux box with glibc < 2.28 (renameat2 landed there); a statically linked or musl-based image without the symbol; running against an overlayfs-backed build root where the symbol probe still passes but the call fails (see error 401).","solutions":["Run the promotion step inside a Linux >= 3.15 environment with a modern glibc (>= 2.28) — the typical fix is to switch the CI runner or dev container to a current Debian/Ubuntu/Fedora image.","Confirm the symbol is exported: `python3 -c \"import ctypes; print(hasattr(ctypes.CDLL(None), 'renameat2'))\"` — `False` confirms the platform is unsupported.","If you cannot get renameat2, avoid the atomic exchange path entirely: do not call `apply_promoted_overlay` / `committed_destination_base_digests` and use a non-atomic publish step instead.","For musl-based images (Alpine), switch to a glibc image or install gcompat so the dynamic loader exposes the glibc symbol."],"exampleFix":"# before: running on macOS / unsupported libc\npython -m workflow_bench.promotion_apply  # -> RuntimeError\n# after: run on a Linux box with renameat2\npython3 -c \"import ctypes; assert hasattr(ctypes.CDLL(None), 'renameat2')\"\npython -m workflow_bench.promotion_apply","handlingStrategy":"validation","validationCode":"import ctypes\n\ndef supports_renameat2_exchange() -> bool:\n    \"\"\"True iff the host libc exposes renameat2 (necessary, not sufficient).\"\"\"\n    try:\n        return hasattr(ctypes.CDLL(None, use_errno=True), \"renameat2\")\n    except OSError:\n        return False\n\n# call before any apply_promoted_overlay\nif not supports_renameat2_exchange():\n    raise SystemExit(\"promotion_apply needs a Linux >= 3.15 host with renameat2\")","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Gate the promotion step on `supports_renameat2_exchange()` at startup so unsupported hosts fail fast with a clear message.","Run the workflow bench only in CI images based on current glibc Linux (Debian/Ubuntu/Fedora), not Alpine musl.","Document in your runbook that `apply_promoted_overlay` and `committed_destination_base_digests` are Linux-only primitives."],"tags":["platform","filesystem","renameat2","atomic","linux-only"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}