Skip to content

Bug: Notation panics on init when $HOME and $XDG_CONFIG_HOME unset #446

@JasonTheDeveloper

Description

@JasonTheDeveloper

What is not working as expected?

The bug relates to an issue raised in fluxcd/flux2#4961

This gist of the issue is when $HOME or $XDC_CONFIG_HOME are unset, dir/path panics when initialising

notation-go/dir/path.go

Lines 82 to 97 in 974c291

func init() {
loadUserPath()
}
// loadUserPath function defines UserConfigDir and UserLibexecDir.
func loadUserPath() {
// set user config
userDir, err := userConfigDir()
if err != nil {
panic(err)
}
UserConfigDir = filepath.Join(userDir, notation)
// set user libexec
UserLibexecDir = UserConfigDir
}

What did you expect to happen?

I would expect notation to not panic, breaking any application importing the notation SDK when $HOME and $XDC_CONFIG_HOME are unset.

How can we reproduce it?

Sets can be found in the reference issue

Describe your environment

OS: Arch Linux, Debian Bookworm
Golang: 1.22.5

What is the version of your notation-go Library?

v1.1.0

Metadata

Metadata

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