Skip to content

Load config issue #1144

@JeyJeyGao

Description

@JeyJeyGao

What is not working as expected?

➜ chmod 0000 ~/.config/notation 
➜ notation 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x850078]

goroutine 1 [running]:
github.com/notaryproject/notation/internal/cmd.init.func2(0xc0000e2900, 0xc0000d64c8)
        /home/jj/projects/junjie/notation/internal/cmd/flags.go:50 +0x38
github.com/notaryproject/notation/internal/cmd.(*SignerFlagOpts).ApplyFlagsToCommand(0xc0000d64b8, 0xc00021c008)
        /home/jj/projects/junjie/notation/internal/cmd/options.go:39 +0x5a
main.signCommand(0xc000076698?)
        /home/jj/projects/junjie/notation/cmd/notation/sign.go:144 +0x1d6
main.main()
        /home/jj/projects/junjie/notation/cmd/notation/main.go:56 +0x79

When the notation config directory lacks permission, it will trigger an error in LoadConfigOnce(). This issue was exposed after the blob signing command was added, which required calling LoadConfigOnce() twice (OCI signing + blob signing command). We need to fix it.

What did you expect to happen?

No error.

How can we reproduce it?

run chmod 0000 ~/.config/notation, then call notation command

Describe your environment

Linux x64

What is the version of your Notation CLI or Notation Library?

main branch

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions