{"record":{"id":"2044742198a27959","repo":"abhigyanpatwari/GitNexus","slug":"oracle-root-must-be-a-real-non-symlink-directory","errorCode":null,"errorMessage":"oracle root must be a real non-symlink directory: {lexical}","messagePattern":"oracle root must be a real non-symlink directory: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":124,"sourceCode":"        source = _bounded_relative_path(declaration.get(\"source\"), label=f\"task {task_id} oracle source\")\n        target = _bounded_relative_path(declaration.get(\"target\"), label=f\"task {task_id} oracle target\")\n        if source.as_posix() in sources:\n            raise ValueError(f\"task {task_id} oracle source is duplicated: {source}\")\n        if target.as_posix() in targets:\n            raise ValueError(f\"task {task_id} oracle target is duplicated: {target}\")\n        sources.add(source.as_posix())\n        targets.add(target.as_posix())\n\n\ndef _real_oracle_root(root: Path) -> Path:\n    lexical = root.expanduser().absolute()\n    try:\n        metadata = lexical.lstat()\n        resolved = lexical.resolve(strict=True)\n    except OSError as exc:\n        raise ValueError(f\"oracle root is unavailable: {lexical}\") from exc\n    if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode) or resolved != lexical:\n        raise ValueError(f\"oracle root must be a real non-symlink directory: {lexical}\")\n    return lexical\n\n\ndef _read_oracle_file(root: Path, relative: PurePosixPath) -> bytes:\n    current = root\n    for part in relative.parts[:-1]:\n        current /= part\n        try:\n            metadata = current.lstat()\n        except OSError as exc:\n            raise ValueError(f\"oracle parent is unreadable: {relative}\") from exc\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n            raise ValueError(f\"oracle parents must be real directories: {relative}\")\n\n    path = root.joinpath(*relative.parts)\n    try:\n        before = path.lstat()\n        if stat.S_ISLNK(before.st_mode) or not stat.S_ISREG(before.st_mode):","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L106-L142","documentation":"Raised by _real_oracle_root when the oracle root exists but is a symlink, is not a directory, or its resolved path differs from its lexical path (i.e. it is reachable through a symlink). The harness requires a real, non-symlink directory to prevent path-traversal and TOCTOU tricks against the oracle store.","triggerScenarios":"oracle root is a symbolic link; it is a regular file rather than a directory; an intermediate component of the path is a symlink causing resolved != lexical.","commonSituations":"Someone symlinked the oracles directory for convenience; the path points at a file; the working directory is itself under a symlink (e.g. /tmp is a symlink on some macOS setups) making resolve() diverge from the lexical absolute path.","solutions":["Point the oracle root at a real directory, not a symlink.","Replace any symlink in the path chain with the actual directory it resolves to.","Ensure no parent directory of the oracle root is a symlink; use readlink -f to find the real location and use that.","Confirm the target is a directory (stat shows S_IFDIR)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import stat\nfrom pathlib import Path\n\ndef assert_real_dir(path: Path) -> None:\n    lex = path.expanduser().absolute()\n    md = lex.lstat()\n    if stat.S_ISLNK(md.st_mode) or not stat.S_ISDIR(md.st_mode) or lex.resolve(strict=True) != lex:\n        raise ValueError(f\"{lex} must be a real non-symlink directory\")","typeGuard":"def is_real_non_symlink_dir(path) -> bool:\n    import stat\n    p = Path(path).expanduser().absolute()\n    try:\n        md = p.lstat()\n    except OSError:\n        return False\n    return not stat.S_ISLNK(md.st_mode) and stat.S_ISDIR(md.st_mode) and p.resolve(strict=True) == p","tryCatchPattern":"try:\n    snap = capture_task_oracle(task, root=root)\nexcept ValueError as exc:\n    if \"must be a real non-symlink directory\" in str(exc):\n        root = root.resolve(strict=True)\n        snap = capture_task_oracle(task, root=root)\n    else:\n        raise","preventionTips":["Never symlink the oracle root; always use the real directory path.","Resolve symlinks in the working directory before computing the oracle root path.","Document the real-directory requirement in benchmark setup instructions."],"tags":["python","benchmark","oracle","security","symlink","filesystem"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}