Conversation
A JSON null runtimes entry decodes to a nil interface. Adding, removing, or looking up a runtime currently asserts that value to a map and panics. Treat a null runtimes entry like an absent entry before the assertion. Cover all three operations using a configuration loaded from a file and verify unrelated settings survive saving the updated configuration. Signed-off-by: xinjun.jiang <xinjun.jiang@daocloud.io>
git-jxj
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
September 22, 2026 08:08
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-ctk runtime configure --runtime=docker --config=daemon.jsonpanics when the file contains{"runtimes":null}. JSON decoding stores a nil interface forruntimes, but the Docker configuration methods assert any present entry to a map.Treat a null
runtimesentry like an absent entry when adding, removing, or looking up a runtime. The new regression loads a file containing null runtimes, exercises all three operations, and verifies that unrelated settings survive saving the configuration.Checklist
make test) — the same four packages and nine subtests fail on unchanged main; see belowmake lint)Testing
nvidia-ctk runtime configurealso exits 2 for a temporary file containing{"runtimes":null,"log-driver":"json-file"}.log-driver, and produces the same configuration on a second run. This used an isolated temporary file; it did not reconfigure or restart Docker.make build,make fmt, andmake lintcompleted. Lint reported 0 issues.go test -race ./pkg/config/... ./cmd/nvidia-ctk/runtime/... -count=1passed.make testwas run on this change and an unchanged checkout of main (84e2c2c182bfa0b2edab4fdca27e5197faba0ca7). Both fail the same nine subtests incmd/nvidia-ctk-installer,cmd/nvidia-ctk-installer/toolkit,internal/modifier, andpkg/nvcdi, involving driver-library discovery in test fixtures and CSV hook expectations. All other packages pass. No GPU container E2E result is claimed for this configuration fix.