Closed zhouhao3 closed 7 years ago
@opencontainers/image-tools-maintainers PTAL
@xiekeyang @coolljt0725 @cyphar @vbatts PTAL
What was the error? Can you include it in the commit message that fixes said error?
The following error occurs when the create
command is executed:
panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x48ef43] goroutine 19 [running]: panic(0x808060, 0xc420010130) /home/zhouhao/go/src/runtime/panic.go:500 +0x1ae testing.tRunner.func1(0xc4200932c0) /home/zhouhao/go/src/testing/testing.go:579 +0x474 panic(0x808060, 0xc420010130) /home/zhouhao/go/src/runtime/panic.go:458 +0x271 github.com/opencontainers/image-tools/image.(*config).runtimeSpec(0xc420676240, 0x85e3f6, 0x6, 0xc4201d3920, 0x1a, 0x0) github.com/opencontainers/image-tools/image/_test/_obj_test/config.go:94 +0x1b3 github.com/opencontainers/image-tools/image.createBundle(0xa2f7e0, 0xc4204fc090, 0xc420543b20, 0xc4200df2a0, 0x13, 0x85e3f6, 0x6, 0x0, 0x0) github.com/opencontainers/image-tools/image/_test/_obj_test/image.go:414 +0x318 github.com/opencontainers/image-tools/image.createRuntimeBundle(0xa2f7e0, 0xc4204fc090, 0xc4200df2a0, 0x13, 0x85e384, 0x6, 0x85e3f6, 0x6, 0x0, 0x0, ...) github.com/opencontainers/image-tools/image/_test/_obj_test/image.go:348 +0x9ce github.com/opencontainers/image-tools/image.CreateRuntimeBundleLayout(0xc4200df180, 0x16, 0xc4200df2a0, 0x13, 0x85e384, 0x6, 0x85e3f6, 0x6, 0x0, 0x0, ...)
Because there is no non-empty check on the optional fields in config.go.
A good title for this PR and the commit might be "image: avoid panic on nil fields when converting".
Also, please take the time to squash this into a single commit.
updated, PTAL.
When I execute the create command, there was an error, but there was no error when making the test. So need to improve the test content, and fix the error.
Signed-off-by: zhouhao zhouhao@cn.fujitsu.com