Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI PANICS when config is a file instead of directory #264

Open
bupd opened this issue Nov 26, 2024 · 4 comments
Open

CLI PANICS when config is a file instead of directory #264

bupd opened this issue Nov 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@bupd
Copy link
Member

bupd commented Nov 26, 2024

To Reproduce this issue

  1. Remove the old config file
  2. create a directory in place of config file. with same name of config file
  3. this causes the cli to panic

Expected Behaviour

Instead of panicking CLI should return error there is a directory in the place of config file.

 

Error output

(PANIC)

> harbor-dev artifacts list
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xa2ca07]

goroutine 1 [running]:
github.com/goharbor/harbor-cli/cmd/harbor/root.InitConfig()
        /src/cmd/harbor/root/cmd.go:34 +0x147
github.com/spf13/cobra.(*Command).preRun(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:1019
github.com/spf13/cobra.(*Command).execute(0xc00036ec08, {0x1245340, 0x0, 0x0})
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:929 +0x5a2
github.com/spf13/cobra.(*Command).ExecuteC(0xc000216608)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0xc0000061c0?)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:1041 +0x13
main.main()
        /src/cmd/harbor/main.go:10 +0x18
       
@qcserestipy
Copy link
Contributor

@bupd is this in the default home directory? Does it also happen after commit 0d1f474 to main?
I can have a look and try to reproduce this issue

@bupd bupd added the bug Something isn't working label Nov 30, 2024
@Standing-Man
Copy link
Contributor

Hi @bupd, I’m a bit unclear about what’s causing the CLI to panic. If it's not too much trouble, could you kindly provide more details about the panic? For example, the error message, steps to reproduce, or any other relevant context would be incredibly helpful. It would allow us to better understand the issue and try to reproduce it on our end, so we can investigate and work towards a solution. Thank you so much for your help!

@bupd
Copy link
Member Author

bupd commented Dec 30, 2024

@Standing-Man

To Reproduce this issue

Remove the old config file
create a directory in place of config file. with same name of config file
this causes the cli to panic

Expected Behaviour

Instead of panicking CLI should return error there is a directory in the place of config file.

@Standing-Man
Copy link
Contributor

Thank you for providing more details on how to reproduce this issue. I will try to figure out what is going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants