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

[Bug] Panic occurs when there is no git #360

Open
muhi111 opened this issue Dec 20, 2024 · 2 comments
Open

[Bug] Panic occurs when there is no git #360

muhi111 opened this issue Dec 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@muhi111
Copy link

muhi111 commented Dec 20, 2024

What is the problem?

Without git installed, running go-blueprint create --name app --framework echo --driver postgres --git skip causes panic. CreateMainFile() at cmd/createate.go:271 returns an error and goes into error handling, but at line 273 ReleaseTerminal() panics (is it bad that p.cancelReader is nil?), and even after recovering, it still panics. The same thing seems to be happening again even after further recovering.

I could not reproduce the same bug on my Ubuntu 22.04 (x86-64). I am not very familiar with go, so please feel free to point out if I am saying something strange.🙇

Operating System

Amazon Linux 2

Architecture Version (x86, x64, arm, etc)

x86_64

Steps to reproduce

  1. With git not installed, run go-blueprint create --name app --framework echo --driver postgres --git skip

Relevant log output

The program encountered an unexpected issue and had to exit. The error was: runtime error: invalid memory address or nil pointer dereference
If you continue to experience this issue, please post a message on our GitHub page or join our Discord server for support.
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=0x18 pc=0x57fa0c]

goroutine 1 [running]:
github.com/charmbracelet/bubbletea.(*Program).ReleaseTerminal(0xc0000fe480)
        /home/ec2-user/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:611 +0x2c
github.com/melkeydev/go-blueprint/cmd.init.func1.2()
        /home/ec2-user/go/pkg/mod/github.com/melkeydev/[email protected]/cmd/create.go:264 +0xbd
panic({0x638960?, 0x8af260?})
        /usr/local/go/src/runtime/panic.go:785 +0x132
github.com/charmbracelet/bubbletea.(*Program).ReleaseTerminal(0xc0000fe480)
        /home/ec2-user/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:611 +0x2c
github.com/melkeydev/go-blueprint/cmd.init.func1(0x8b71c0, {0x8dcbc0?, 0x0?, 0x0?})
        /home/ec2-user/go/pkg/mod/github.com/melkeydev/[email protected]/cmd/create.go:273 +0x1f0b
github.com/spf13/cobra.(*Command).execute(0x8b71c0, {0x8dcbc0, 0x0, 0x0})
        /home/ec2-user/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0x8b74a0)
        /home/ec2-user/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /home/ec2-user/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/melkeydev/go-blueprint/cmd.Execute()
        /home/ec2-user/go/pkg/mod/github.com/melkeydev/[email protected]/cmd/root.go:20 +0x1a
main.main()
        /home/ec2-user/go/pkg/mod/github.com/melkeydev/[email protected]/main.go:6 +0xf
@Ujstor
Copy link
Collaborator

Ujstor commented Dec 23, 2024

This shouldn't happen, especially since the skip flag is specifically designed to handle cases without Git.

We're not properly handling the Git-not-installed scenario even when the user explicitly requests to skip Git functionality and ReleaseTerminal() is being called when the Program isn't properly initialized.

@Ujstor Ujstor added the bug Something isn't working label Dec 23, 2024
@Ujstor
Copy link
Collaborator

Ujstor commented Dec 23, 2024

Bug is not critical because most of the users have Git installed, but it would be good to fix this in the near future.

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

2 participants