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

Panic in event.pathFromSource when doing record on quoted path ending with backslash #106

Open
idbrii opened this issue Jul 21, 2020 · 0 comments

Comments

@idbrii
Copy link

idbrii commented Jul 21, 2020

In short: doing gtm record "c:\Users\" causes a panic.


I'm using gtm-vim and vim-dirvish. gtm-vim had a bug git-time-metric/gtm-vim-plugin#6 that made it try to run gtm record on directories. vim-dirvish lets you edit directories, so gtm-vim tried to record them.

I added output to gtm-vim to see why gtm kept saying it wasn't available:

patch:
     if v:shell_error
       echoerr s:no_gtm_err
+      echom output
     else

And here's the output I get

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

goroutine 1 [running]:
github.com/git-time-metric/gtm/event.pathFromSource(0xc04208e000, 0x45, 0xc042079c30, 0x4e8a7e, 0xc04209a180, 0x6d0200, 0x0, 0x0)
	c:/gopath/src/github.com/git-time-metric/gtm/event/event.go:19 +0xde
github.com/git-time-metric/gtm/event.Record(0xc04208e000, 0x45, 0x1, 0x2)
	c:/gopath/src/github.com/git-time-metric/gtm/event/manager.go:20 +0x40
github.com/git-time-metric/gtm/command.RecordCmd.Run(0x951500, 0xc0420b0320, 0x0, 0xc04205a0e0, 0x1, 0x2, 0x0)
	c:/gopath/src/github.com/git-time-metric/gtm/command/record.go:100 +0x295
github.com/git-time-metric/gtm/command.(*RecordCmd).Run(0xc042058cc0, 0xc04205a0e0, 0x1, 0x2, 0xc042052860)
	<autogenerated>:1 +0x73
github.com/mitchellh/cli.(*CLI).Run(0xc042060500, 0xc042096c60, 0x70efa1, 0x5)
	c:/gopath/src/github.com/mitchellh/cli/cli.go:255 +0x1f2
main.main()
	c:/gopath/src/github.com/git-time-metr

I'm using gtm.exe from gtm.v1.3.5.windows.tar.gz, git-time-metric/gtm-vim-plugin@ebd33f7, and gvim 8.2.1076.

This is the specific command that gtm-vim was trying to run:

:echo system('gtm record "C:\david\settings\daveconfig\multi\vim\bundle\git-time-metric\plugin\"')

C:\settings\daveconfig is a git repo and C:\david\settings\daveconfig\multi\vim\bundle\git-time-metric is a submodule.

I get a panic 100% of the time when I run that command or with any path with a trailing \.

" fine
:echo system('gtm record "C:\david"')
" fine
:! gtm record C:\david\
" panic
:echo system('gtm record "C:\david\"')
" panic
:! gtm record "C:\david\"

Or panic from a command prompt:

> gtm record "c:\david\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant