{"record":{"id":"5b3b92698104ad66","repo":"abhigyanpatwari/GitNexus","slug":"oracle-source-is-unreadable-relative","errorCode":null,"errorMessage":"oracle source is unreadable: {relative}","messagePattern":"oracle source is unreadable: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":148,"sourceCode":"    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):\n            raise ValueError(f\"oracle source must be a bounded regular non-symlink file: {relative}\")\n        descriptor = os.open(path, os.O_RDONLY | getattr(os, \"O_NOFOLLOW\", 0))\n    except ValueError:\n        raise\n    except OSError as exc:\n        raise ValueError(f\"oracle source is unreadable: {relative}\") from exc\n    try:\n        opened = os.fstat(descriptor)\n        if (\n            stat.S_ISLNK(before.st_mode)\n            or not stat.S_ISREG(before.st_mode)\n            or not stat.S_ISREG(opened.st_mode)\n            or before.st_dev != opened.st_dev\n            or before.st_ino != opened.st_ino\n            or opened.st_size > MAX_ORACLE_FILE_BYTES\n        ):\n            raise ValueError(f\"oracle source must be a bounded regular non-symlink file: {relative}\")\n        chunks: list[bytes] = []\n        remaining = MAX_ORACLE_FILE_BYTES + 1\n        while remaining > 0:\n            chunk = os.read(descriptor, min(64 * 1024, remaining))\n            if not chunk:\n                break\n            chunks.append(chunk)","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L130-L166","documentation":"Raised by _read_oracle_file when os.open() (with O_RDONLY | O_NOFOLLOW) on the oracle source file raises OSError for any reason other than the pre-open ValueError checks. This covers permission denied, file vanished between lstat and open, I/O errors, or filesystem-level refusal. The NUL/symlink checks are re-raised as their own ValueErrors; everything else funnels here.","triggerScenarios":"The oracle file exists and is regular but the process lacks read permission; the file is deleted between the lstat and the open call; a filesystem error occurs during open; O_NOFOLLOW is enforced and the kernel rejects the path.","commonSituations":"Oracle files installed with restrictive ownership (root-owned, mode 0o400 owned by another user); container user mismatch; NFS/filesystem hiccup; TOCTOU where the file is removed mid-capture.","solutions":["Check read permissions on the oracle source file: chmod/chown so the harness user can read it.","Re-run capture — a transient filesystem error may not recur.","Ensure no concurrent process is modifying or removing oracle assets during capture.","Verify the file is still present with ls -l immediately before capture."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os\nfrom pathlib import Path\n\ndef assert_readable(root: Path, relative) -> None:\n    p = root.joinpath(*Path(relative).parts)\n    if not os.access(p, os.R_OK):\n        raise PermissionError(f\"oracle file not readable: {p}\")","typeGuard":"def oracle_file_readable(root, relative) -> bool:\n    import os\n    p = Path(root).joinpath(*Path(relative).parts)\n    return os.access(p, os.R_OK)","tryCatchPattern":"try:\n    payload = _read_oracle_file(root, relative)\nexcept ValueError as exc:\n    if \"unreadable\" in str(exc):\n        raise SystemExit(f\"Permission/access error on oracle file {relative}: {exc}\") from exc\n    raise","preventionTips":["Ensure the harness process owns or can read oracle files (chmod +r).","Run capture in an environment with no concurrent file mutations.","Verify file presence with ls -l immediately before capture."],"tags":["python","benchmark","oracle","filesystem","permissions","toctou"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}