-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions welcomeContributions welcomep3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Description
Describe the bug
Having an IPv6 literal in a remote url causes SIGSEGV in gh pr create.
❯ gh --version
gh version 2.43.1 (2024-02-01)
https://github.com/cli/cli/releases/tag/v2.43.1
Steps to reproduce the behavior
- Clone some repo from github
- Add a remote that utilizes an IPv6 literal, like
ssh://git@[::1]:22/tmp/git-repo - Run
gh pr create - Witness SIGSEGV
Expected vs actual behavior
I'd expect this to work without a segfault, even if there's a remote using IPv6 literals.
Logs
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x7d0e91]
goroutine 1 [running]:
github.com/cli/go-gh/v2/pkg/ssh.(*Translator).Translate(0x0?, 0xc0006aa090)
/builddir/github-cli-2.43.1/_build-github-cli-xbps/pkg/mod/github.com/cli/go-gh/v2@v2.5.0/pkg/ssh/ssh.go:43 +0xb1
github.com/cli/cli/v2/context.TranslateRemotes({0xc0007326a0, 0x2, 0xc000822e00?}, {0x2479aa0, 0xc00068c660})
/builddir/github-cli-2.43.1/context/remote.go:109 +0x89
github.com/cli/cli/v2/pkg/cmd/factory.New.remotesFunc.(*remoteResolver).Resolver.func6()
/builddir/github-cli-2.43.1/pkg/cmd/factory/remote_resolver.go:49 +0x105
github.com/cli/cli/v2/pkg/cmd/pr/create.getRemotes(0xc000002d80)
/builddir/github-cli-2.43.1/pkg/cmd/pr/create/create.go:667 +0x18
github.com/cli/cli/v2/pkg/cmd/pr/create.NewCreateContext(0xc000002d80)
/builddir/github-cli-2.43.1/pkg/cmd/pr/create/create.go:515 +0x88
github.com/cli/cli/v2/pkg/cmd/pr/create.createRun(0xc000002d80)
/builddir/github-cli-2.43.1/pkg/cmd/pr/create/create.go:224 +0x3b
github.com/cli/cli/v2/pkg/cmd/pr/create.NewCmdCreate.func1(0xc0002bba00?, {0x2dca240?, 0x4?, 0x15095eb?})
/builddir/github-cli-2.43.1/pkg/cmd/pr/create/create.go:187 +0x786
github.com/spf13/cobra.(*Command).execute(0xc0002f5200, {0x2dca240, 0x0, 0x0})
/builddir/github-cli-2.43.1/_build-github-cli-xbps/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004300)
/builddir/github-cli-2.43.1/_build-github-cli-xbps/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3a5
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
/builddir/github-cli-2.43.1/_build-github-cli-xbps/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:977
main.mainRun()
/builddir/github-cli-2.43.1/cmd/gh/main.go:119 +0x5db
main.main()
/builddir/github-cli-2.43.1/cmd/gh/main.go:46 +0x13
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions welcomeContributions welcomep3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic