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

Null dereference when pushing and pulling several times in a row #4150

Open
0dminnimda opened this issue Jan 4, 2025 · 0 comments
Open

Null dereference when pushing and pulling several times in a row #4150

0dminnimda opened this issue Jan 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@0dminnimda
Copy link

I was looking at a submodule, I was not sure that I got the latest and greatest commit, and I decided to do several pushes and pulls. Since it's a detached branch, two options for both push and pull were shown to me, I was using both as it is easy to forget which is the right one, and after a dozen of pushed and pulls lazygit crashed. I was able to reproduce it in the same repo one more time, with more pushed and pulls, and then I could not reproduce it. Also the submodule has a different path to from it's initial one (but was safely moved with git mv)

Update: I reproduces it the third time! I think you need to do pulls several times.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a repo submodule
  2. Do pulls for both options for some time
  3. Crash

Expected behavior

No crashes

Version info

$ lazygit --version
commit=611fabde11d24d9acc71ee26077b9a1101f59f27, build date=2024-09-18T10:56:10Z, build source=binaryRelease, version=0.44.1, os=windows, arch=amd64, git version=2.42.0.windows.1
$ git --version
git version 2.42.0.windows.1

Windows Terminal
Bash from Git for Windows

Screen Pastes

First crash:

$ lazygit
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1428808]

goroutine 1 [running]:
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*ConfirmationHelper).setKeyBindings.(*ConfirmationHelper).wrappedPromptConfirmationFunction.func5()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/confirmation_helper.go:45 +0x28
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*ConfirmationHelper).setKeyBindings.(*ConfirmationHelper).wrappedPromptConfirmationFunction.(*ConfirmationHelper).wrappedConfirmationFunction.func8()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/confirmation_helper.go:34 +0x5a
github.com/jesseduffield/lazygit/pkg/gui/controllers.(*SuggestionsController).GetKeybindings.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/suggestions_controller.go:35 +0x3b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).callKeybindingHandler(0xc000210608, 0xc0003377c0?)
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:465 +0x104
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:412 +0x1b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.(*Gui).wrappedHandler.func3(0xdd3790?, 0xdc250e?)
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:406 +0x13
github.com/jesseduffield/gocui.(*Gui).execKeybinding(0xc00036f4a8?, 0xd924bb?, 0xc00036f620?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1529 +0x4a
github.com/jesseduffield/gocui.(*Gui).execKeybindings(0xc000104a80, 0xc0000bc400, 0xc00036f5a0)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1497 +0x3e5
github.com/jesseduffield/gocui.(*Gui).onKey(0xc000270058?, 0xc00036f528?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1308 +0x1de
github.com/jesseduffield/gocui.(*Gui).handleEvent(0xc000270030?, 0xc00036f588?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:842 +0x39
github.com/jesseduffield/gocui.(*Gui).processEvent(0xc000104a80)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:796 +0x22f
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc000104a80)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:775 +0xd7
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc000210608, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:846 +0x4fd
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:852 +0x45
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc000117e00?)
        /home/runner/work/lazygit/lazygit/pkg/utils/utils.go:99 +0x5c
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc000210608, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:851 +0xce
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(...)
        /home/runner/work/lazygit/lazygit/pkg/app/app.go:270
github.com/jesseduffield/lazygit/pkg/app.Run({0x18d6418?, 0xc0001624d0?}, 0xc000216580, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/app/app.go:48 +0xd6
github.com/jesseduffield/lazygit/pkg/app.Start(0xc000139f00, {0x0, 0x0})
        /home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:167 +0xd05
main.main()
        /home/runner/work/lazygit/lazygit/main.go:23 +0x98

Second:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1428808]

goroutine 1 [running]:
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*ConfirmationHelper).setKeyBindings.(*ConfirmationHelper).wrappedPromptConfirmationFunction.func5()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/confirmation_helper.go:45 +0x28
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*ConfirmationHelper).setKeyBindings.(*ConfirmationHelper).wrappedPromptConfirmationFunction.(*ConfirmationHelper).wrappedConfirmationFunction.func8()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/confirmation_helper.go:34 +0x5a
github.com/jesseduffield/lazygit/pkg/gui/controllers.(*SuggestionsController).GetKeybindings.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/suggestions_controller.go:35 +0x3b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).callKeybindingHandler(0xc0001fc008, 0xc0007ba320?)
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:465 +0x104
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:412 +0x1b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.(*Gui).wrappedHandler.func3(0xdd3790?, 0xdc250e?)
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:406 +0x13
github.com/jesseduffield/gocui.(*Gui).execKeybinding(0xc0003614a8?, 0xd924bb?, 0xc000361620?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1529 +0x4a
github.com/jesseduffield/gocui.(*Gui).execKeybindings(0xc000075500, 0xc00017c400, 0xc0003615a0)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1497 +0x3e5
github.com/jesseduffield/gocui.(*Gui).onKey(0xc0001f0058?, 0xc000361528?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1308 +0x1de
github.com/jesseduffield/gocui.(*Gui).handleEvent(0xc0001f0030?, 0xc000361588?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:842 +0x39
github.com/jesseduffield/gocui.(*Gui).processEvent(0xc000075500)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:796 +0x22f
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc000075500)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:775 +0xd7
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc0001fc008, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:846 +0x4fd
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:852 +0x45
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc000134300?)
        /home/runner/work/lazygit/lazygit/pkg/utils/utils.go:99 +0x5c
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc0001fc008, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:851 +0xce
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(...)
        /home/runner/work/lazygit/lazygit/pkg/app/app.go:270
github.com/jesseduffield/lazygit/pkg/app.Run({0x18d6418?, 0xc00011a2c0?}, 0xc00011c740, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/app/app.go:48 +0xd6
github.com/jesseduffield/lazygit/pkg/app.Start(0xc0000adf00, {0x0, 0x0})
        /home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:167 +0xd05
main.main()
        /home/runner/work/lazygit/lazygit/main.go:23 +0x98

Third:

$ lazygit --debug
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1428808]

goroutine 1 [running]:
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*ConfirmationHelper).setKeyBindings.(*ConfirmationHelper).wrappedPromptConfirmationFunction.func5()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/confirmation_helper.go:45 +0x28
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*ConfirmationHelper).setKeyBindings.(*ConfirmationHelper).wrappedPromptConfirmationFunction.(*ConfirmationHelper).wrappedConfirmationFunction.func8()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/helpers/confirmation_helper.go:34 +0x5a
github.com/jesseduffield/lazygit/pkg/gui/controllers.(*SuggestionsController).GetKeybindings.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/controllers/suggestions_controller.go:35 +0x3b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).callKeybindingHandler(0xc0001d4008, 0xc000399540?)
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:465 +0x104
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:412 +0x1b
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).SetKeybinding.(*Gui).wrappedHandler.func3(0xdd3790?, 0xdc250e?)
        /home/runner/work/lazygit/lazygit/pkg/gui/keybindings.go:406 +0x13
github.com/jesseduffield/gocui.(*Gui).execKeybinding(0xc00125f4a8?, 0xd924bb?, 0xc00125f620?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1529 +0x4a
github.com/jesseduffield/gocui.(*Gui).execKeybindings(0xc000075340, 0xc000132400, 0xc00125f5a0)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1497 +0x3e5
github.com/jesseduffield/gocui.(*Gui).onKey(0xc00032e058?, 0xc00125f528?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:1308 +0x1de
github.com/jesseduffield/gocui.(*Gui).handleEvent(0xc00032e030?, 0xc00125f588?)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:842 +0x39
github.com/jesseduffield/gocui.(*Gui).processEvent(0xc000075340)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:796 +0x22f
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc000075340)
        /home/runner/work/lazygit/lazygit/vendor/github.com/jesseduffield/gocui/gui.go:775 +0xd7
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc0001d4008, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:846 +0x4fd
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:852 +0x45
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc000118440?)
        /home/runner/work/lazygit/lazygit/pkg/utils/utils.go:99 +0x5c
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc0001d4008, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/gui/gui.go:851 +0xce
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(...)
        /home/runner/work/lazygit/lazygit/pkg/app/app.go:270
github.com/jesseduffield/lazygit/pkg/app.Run({0x18d6418?, 0xc0001640b0?}, 0xc000124380, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        /home/runner/work/lazygit/lazygit/pkg/app/app.go:48 +0xd6
github.com/jesseduffield/lazygit/pkg/app.Start(0xc0000adf00, {0x0, 0x0})
        /home/runner/work/lazygit/lazygit/pkg/app/entry_point.go:167 +0xd05
main.main()
        /home/runner/work/lazygit/lazygit/main.go:23 +0x98
$ lazygit --logs
Tailing log file C:\Users\ASUS\AppData\Local\lazygit\development.log

Jan  4 17:01:47 |INFO| Heap memory in use: 9.6 MB
Jan  4 17:01:47 |INFO| refreshed merge conflicts in 0s
Jan  4 17:01:47 |DEBU| using cache for key status.showUntrackedFiles
Jan  4 17:01:47 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z --find-renames=50%"
Jan  4 17:01:47 |INFO| git status --untracked-files=all --porcelain -z --find-renames=50% (54.3657ms)
Jan  4 17:01:47 |INFO| refreshed files in 94.8503ms
Jan  4 17:01:47 |INFO| Refresh took 95.4205ms
Jan  4 17:01:47 |INFO| postRefreshUpdate for submodules took 0s
Jan  4 17:01:47 |INFO| postRefreshUpdate for files took 0s
Jan  4 17:01:49 |DEBU| RunCommand command="git fetch --all --no-write-fetch-head"

development.log

options:

╭─Enter upstream as '<remote> <branchname>'───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│origin a9950d64f78c11cba4d4ffeb6c0efc0312df1141                                                                                                          │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─Suggestions (press <tab> to focus)──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│origin main                                                                                                                                              │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
│                                                                                                                                                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────1 of 1─╯

Wrong option for push will show something like this:

error: The destination you provided is not a full refname (i.e.,                                        
starting with "refs/"). We tried to guess what you meant by:                                            
                                                                                                        
- Looking for a ref that matches 'a9950d64f78c11cba4d4ffeb6c0efc0312df1141' on the remote side.         
- Checking if the <src> being pushed ('HEAD')                                                           
  is a ref in "refs/{heads,tags}/". If so we add a corresponding                                        
  refs/{heads,tags}/ prefix on the remote side.                                                         
                                                                                                        
Neither worked, so we gave up. You must fully qualify the ref.                                          
hint: The <src> part of the refspec is a commit object.                                                 
hint: Did you mean to create a new branch by pushing to                                                 
hint: 'HEAD:refs/heads/a9950d64f78c11cba4d4ffeb6c0efc0312df1141'?                                       
error: failed to push some refs to 'github.com:0dminnimda/neovim_config.git'                            

Both pulls now show me this (I think this is the result of the crash):

fatal: could not set upstream of HEAD to origin/main when it does not point to any branch.
@0dminnimda 0dminnimda added the bug Something isn't working label Jan 4, 2025
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

1 participant