Conversation
Reject dotted --set keys that continue past a boolean, string, slice, or pointer leaf before enumerating fields with reflection. Return the existing invalid-option error instead of panicking. Cover malformed paths through the parser and command handler, preserve configuration files on failure, and retain valid nested and optional boolean settings. Signed-off-by: Arash Javanmardi <arash@javanmardi.info>
ajavanma
requested review from
cdesiniotis,
henry118 and
tariq1890
as code owners
September 18, 2026 08:49
ajavanma
force-pushed
the
fix/config-set-path-panic
branch
from
September 18, 2026 09:08
91831b1 to
819bb3f
Compare
|
Thanks for the contribution. We will review this PR soon. |
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
Reject
config --setkeys that continue past a non-struct field. A key such asdisable-require.extra=truecurrently reaches a boolean during recursive TOML-field lookup and panics. Checking the current type before enumerating fields returns the existing wrapped invalid-option error instead.Add parser and real command-handler regressions for boolean, string, slice, and pointer fields. Tests also verify that invalid input preserves the configuration file and that valid nested paths, list values, and optional boolean values still work.
Checklist
make test)make lint)Testing
3a6c050d9c0c7b2516ce17e2190fb7e71b741f82.go test ./cmd/nvidia-ctk/config -run '^TestConfigCommandSet$' -count=1: four malformed-path cases fail on unchanged production code; valid controls pass.go test ./cmd/nvidia-ctk/config -count=1: passes with the fix.make fmt,make build,make test: pass on Linux ARM64 with Go 1.26.1.make lint: passes with golangci-lint 2.13.2, zero issues.nvidia-ctkbinary against temporary files: all four malformed paths return exit 1 with invalid-option errors, no panic, and unchanged file contents. A valid multi-set command preserves nested strings, serializes lists, and removes an optional boolean set to nil.