Repository navigation
fix: clean the driver root so a trailing / does not leave relative paths - #2179
Open
protonnegativo wants to merge 1 commit into
Open
protonnegativo wants to merge 1 commit into
protonnegativo wants to merge 1 commit into
Conversation
protonnegativo
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
October 27, 2026 04:16
protonnegativo
force-pushed
the
fix/libcuda-dir-trailing-slash
branch
3 times, most recently
from
October 28, 2026 02:38
920e5d4 to
1092a0f
Compare
Contributor
|
@protonnegativo in addition to the DCO sign-off, can you also cryptographically sign your commit? Thanks. |
tariq1890
reviewed
Nov 3, 2026
Comment on lines
+60
to
+61
| // A root such as /run/nvidia/driver/ would otherwise leave relative paths | ||
| // when the root is trimmed from located paths. |
Contributor
There was a problem hiding this comment.
These comments are unnecessary. Please remove them
The driver root is trimmed from located paths as a plain string prefix, for example in RelativeToRoot. With a driver root such as /run/nvidia/driver/ the result lost its leading separator, so the generated CDI spec set NVIDIA_CTK_LIBCUDA_DIR=lib/x86_64-linux-gnu instead of /lib/x86_64-linux-gnu. Clean the root once when the Driver is constructed. Signed-off-by: Dennys Kaluzny Pereira <protonnegativo@users.noreply.github.com>
protonnegativo
force-pushed
the
fix/libcuda-dir-trailing-slash
branch
from
November 6, 2026 17:59
1092a0f to
943ed2c
Compare
Author
|
Thanks @cdesiniotis. I've re-signed the commit (SSH signing key, now showing as Verified) and force-pushed; the DCO sign-off is unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the driver root ends in a separator (for example
--driver-root=/run/nvidia/driver/), the generated CDI spec has a relativeNVIDIA_CTK_LIBCUDA_DIR. Reproduced with theTestGenerateSpecsetup (mock NVML,testdata/lookup/rootfs-1) and/appended to the driver root:Without the trailing
/the value is/lib/x86_64-linux-gnu. Tools in the container that read this variable to find the injectedlibcuda.so(#1028) get a relative path.root.Drivertrims its root from located paths as a plain string prefix (RelativeToRoot, andgetVersionLibsinpkg/nvcdi/driver-nvml.go), so/run/nvidia/driver/usr/lib64becameusr/lib64. The mounts in the spec were not affected becausediscover.NewMountsalready cleans its root. This PR cleans the root once inroot.New, so every user ofDriver.Rootsees the same normalized value.Testing
TestLocatecase with a driver root ending in/. It fails on main (usr/lib64instead of/usr/lib64) and passes with the fix.TestGenerateSpec"default" setup (mock NVML,testdata/lookup/rootfs-1) with a trailing/on the driver root as a one-off check. Before the fix:NVIDIA_CTK_LIBCUDA_DIR=lib/x86_64-linux-gnu. After:/lib/x86_64-linux-gnu. Mounts andupdate-ldcache --foldervalues are unchanged.go test ./internal/lookup/... ./internal/discover/... ./internal/modifier/... ./pkg/nvcdi/... ./cmd/nvidia-ctk/... ./cmd/nvidia-ctk-installer/...pass.gofmt -s -lis clean.