Repository navigation
Trim whitespace in requested driver capabilities - #2154
Closed
unknownhackerworld wants to merge 1 commit into
Closed
unknownhackerworld wants to merge 1 commit into
unknownhackerworld wants to merge 1 commit into
Conversation
unknownhackerworld
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
October 20, 2026 11:06
unknownhackerworld
force-pushed
the
fix/trim-driver-capabilities
branch
from
October 20, 2026 11:10
297979a to
5ede862
Compare
Member
|
@unknownhackerworld please cryptographically sign the commit |
The graphics modifier read NVIDIA_DRIVER_CAPABILITIES with a plain split, so "compute, graphics" did not match "graphics" and the graphics libraries were not injected. Parse it with NewDriverCapabilities, as the runtime hook already does. Signed-off-by: Allen Joseph G <63872540+unknownhackerworld@users.noreply.github.com>
unknownhackerworld
force-pushed
the
fix/trim-driver-capabilities
branch
from
October 26, 2026 19:33
5ede862 to
20644dc
Compare
Author
|
Thanks @henry118, I've re-pushed the commit signed. |
|
Sorry @unknownhackerworld, we are unable to accept this contribution as we only see github in the key. |
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.
Description
NVIDIA_DRIVER_CAPABILITIESis parsed two different ways, and they disagree when the value has whitespace or empty entries.Root cause.
CUDA.GetDriverCapabilities()ininternal/config/image/cuda_image.gosplit the variable on,and used every piece as is:The legacy hook path (
getDriverCapabilitiesincmd/nvidia-container-runtime-hook/container_config.go) instead usesimage.NewDriverCapabilities, which trims each entry and skips empty ones.GetDriverCapabilities()is whatrequiresGraphicsModifierininternal/modifier/graphics.gouses to decide whether to inject the graphics libraries and DRM devices. So withNVIDIA_DRIVER_CAPABILITIES="compute, graphics":nvidia-container-clipath treatsgraphicsas requested" graphics", decides that neithergraphicsnordisplaywas requested, and skips the modificationThe container gets compute but silently misses the graphics (Vulkan/EGL/GLX) libraries. As a side effect, an unset or empty variable also produced a map with a single
""key.Fix.
GetDriverCapabilities()now returnsNewDriverCapabilities(i.env[EnvVarNvidiaDriverCapabilities]), so both paths use the same parser. Valid values without whitespace give the same result as before.Tradeoffs / alternatives.
NewDriverCapabilitieskeeps one parser for this variable instead of two that can drift apart again.Duplicate check. I searched open and closed issues and PRs for
NVIDIA_DRIVER_CAPABILITIES,GetDriverCapabilitiesand capability whitespace handling. The only related open PR is #2122, which changes the panic message in the hook'sgetDriverCapabilitiesand does not touch this parser.AI assistance (an AI coding agent) was used to find this bug, write the fix and tests, run the tests below, and draft this description.
Checklist
make test) - see Testing for the exact commandsmake lint) -golangci-lintwas not available in my environment.go vetandgofmt -lare clean for the changed packages.Testing
TestGetDriverCapabilitiesininternal/config/image/cuda_image_test.gocovers unset, empty, plain, whitespace-padded and empty-entry values.TestGraphicsModifier(internal/modifier/graphics_test.go):NVIDIA_DRIVER_CAPABILITIES="compute, graphics"must create the graphics modifier.Before the fix (fix reverted, tests kept):
After the fix:
go test ./...passes except thecmd/nvidia-container-runtimetests that need the builtnvidia-container-runtimebinary onPATH. Those fail the same way without this change. This was not tested on a GPU node.