Skip to content

[BUG]: missing-library diagnostics mask not-found errors when directory listing fails #3366

Open

Description

@0z5a

Is this a duplicate?

  • I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct.

Type of Bug

Runtime Error

Component

cuda.pathfinder

Describe the bug

When a static or bitcode library is missing, the CUDA Toolkit search tries to list the target directory for diagnostics. If the directory is searchable but not readable, the listing raises PermissionError and replaces the documented BitcodeLibNotFoundError or StaticLibNotFoundError. A caller catching the documented exception cannot handle the missing library as expected.

The same problem occurs if the directory disappears between the directory check and the diagnostic listing.

Reproduced on main at commit deb3d040b6d31b8514f19d026c298982c9b6260b.

How to Reproduce

Run as an unprivileged user on a POSIX filesystem, in a clean Python environment without NVIDIA wheel directories taking precedence:

import os
import tempfile
from pathlib import Path

from cuda.pathfinder import (
    find_bitcode_lib,
    find_static_lib,
    get_cuda_path_or_home,
    locate_bitcode_lib,
    locate_static_lib,
)

os.environ.pop("CUDA_PATH", None)
os.environ.pop("CONDA_PREFIX", None)

with tempfile.TemporaryDirectory() as temporary:
    root = Path(temporary)
    directories = [root / "nvvm" / "libdevice", root / "lib64"]
    for directory in directories:
        directory.mkdir(parents=True)
        directory.chmod(0o111)
    os.environ["CUDA_HOME"] = str(root)
    get_cuda_path_or_home.cache_clear()

    try:
        for name, lookup in (
            ("find_bitcode", lambda: find_bitcode_lib("device")),
            ("locate_bitcode", lambda: locate_bitcode_lib("device")),
            ("find_static", lambda: find_static_lib("cudadevrt")),
            ("locate_static", lambda: locate_static_lib("cudadevrt")),
        ):
            try:
                lookup()
            except Exception as exc:
                print(name, type(exc).__name__)
    finally:
        for directory in directories:
            directory.chmod(0o700)

Observed on Linux: all four calls print PermissionError.

Expected behavior

Bitcode lookups raise BitcodeLibNotFoundError, and static-library lookups raise StaticLibNotFoundError. The exception message should retain the original directory-listing failure so the permission problem remains visible.

Operating System

Linux x86_64 and aarch64, Python 3.12.3.

nvidia-smi output

Not GPU-dependent; reproduced with CUDA devices hidden.

Activity

  1. added
    bugSomething isn't working
    cuda.pathfinderEverything related to the cuda.pathfinder module
    P2Low priority - Nice to have
    and removed
    triageNeeds the team's attention
    on Nov 6, 2026
  2. added this to the cuda.pathfinder next milestone on Nov 6, 2026
  3. Andy-Jost commented on Nov 6, 2026

    @Andy-Jost
    Contributor

    Thanks for the report and for the linked fix in #3367. This is triaged as a cuda.pathfinder bug and assigned to the area owner, who will review the issue and the fix together.

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

Metadata

Metadata

Assignees

Labels

P2Low priority - Nice to havebugSomething isn't workingcuda.pathfinderEverything related to the cuda.pathfinder modulegood first issueGood for newcomers

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions