talisman icon indicating copy to clipboard operation
talisman copied to clipboard

command crashing with error :'panic: runtime error: index out of range [1] with length 1'

Open alreichf opened this issue 5 years ago • 10 comments

Describe the bug ~/.talisman/bin/talisman_linux_amd64 --scan

d8888b. db db d8b db d8b db d888888b d8b db d888b .d8888. .o88b. .d8b. d8b db 88 8D 88 88 888o 88 888o 88 88' 888o 88 88' Y8b 88' YP d8P Y8 d8' 8b 888o 88 88oobY' 88 88 88V8o 88 88V8o 88 88 88V8o 88 88 8bo. 8P 88ooo88 88V8o 88 888b 88 88 88 V8o88 88 V8o88 88 88 V8o88 88 ooo Y8b. 8b 88~~~88 88 V8o88 88 88. 88b d88 88 V888 88 V888 .88. 88 V888 88. ~8~ db 8D Y8b d8 88 88 88 V888 db db 88 YD ~Y8888P' VP V8P VP V8P Y888888P VP V8P Y888P 8888Y' `Y88P' YP YP VP V8P VP VP

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]: talisman/scanner.getBlobsFromChannel(0xc00013db90, 0xc00019a180) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:59 +0x360 talisman/scanner.getBlobsInCommit(0xc0) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:38 +0xfe talisman/scanner.GetAdditions(0x8971a9, 0xe, 0x8936d1) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:17 +0x37 main.(*Runner).Scan(0xc0000d3d78, 0x0, 0x0, 0xed73e8) /home/travis/gopath/src/github.com/thoughtworks/talisman/runner.go:54 +0x8f main.run(0xb8f120, 0xc000010018, 0x0, 0x894c5e, 0x8, 0x0, 0x0, 0x1, 0x0, 0x0, ...) /home/travis/gopath/src/github.com/thoughtworks/talisman/talisman.go:119 +0x703 main.main() /home/travis/gopath/src/github.com/thoughtworks/talisman/talisman.go:99 +0x53e To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

alreichf avatar Jun 22 '20 10:06 alreichf

Can you please try ~/.talisman/bin/talisman_linux_amd64 --debug --scan and paste the results? @alreichf

harinee avatar Jun 22 '20 12:06 harinee

~/.talisman/bin/talisman_linux_amd64 --debug --scan INFO[0000] Running scanner

d8888b. db db d8b db d8b db d888888b d8b db d888b .d8888. .o88b. .d8b. d8b db 88 8D 88 88 888o 88 888o 88 88' 888o 88 88' Y8b 88' YP d8P Y8 d8' 8b 888o 88 88oobY' 88 88 88V8o 88 88V8o 88 88 88V8o 88 88 8bo. 8P 88ooo88 88V8o 88 888b 88 88 88 V8o88 88 V8o88 88 88 V8o88 88 ooo Y8b. 8b 88~~~88 88 V8o88 88 88. 88b d88 88 V888 88 V888 .88. 88 V888 88. ~8~ db 8D Y8b d8 88 88 88 V888 db db 88 YD ~Y8888P' VP V8P VP V8P Y888888P VP V8P Y888P 8888Y' `Y88P' YP YP VP V8P VP VP

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]: talisman/scanner.getBlobsFromChannel(0xc000139c80, 0xc00019c180) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:59 +0x360 talisman/scanner.getBlobsInCommit(0x80) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:38 +0xfe talisman/scanner.GetAdditions(0x8971a9, 0xe, 0x8936d1) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:17 +0x37 main.(*Runner).Scan(0xc0000d3d78, 0x0, 0x0, 0xed73e8) /home/travis/gopath/src/github.com/thoughtworks/talisman/runner.go:54 +0x8f main.run(0xb8f120, 0xc000010018, 0x1, 0x894c5e, 0x8, 0x0, 0x0, 0x1, 0x0, 0x0, ...) /home/travis/gopath/src/github.com/thoughtworks/talisman/talisman.go:119 +0x703 main.main() /home/travis/gopath/src/github.com/thoughtworks/talisman/talisman.go:99 +0x53e

alreichf avatar Jun 22 '20 12:06 alreichf

hi @harinee , please if you could let me know if you got a chance to take a look at my issue.

alreichf avatar Jun 23 '20 08:06 alreichf

@alreichf I am not able to reproduce this. Could you please provide more information?

  1. OS and version?
  2. What steps did you follow to install the talisman binary?
  3. What happens when you run talisman --scan ? (I am guessing it should give the same output, but please confirm, so that we know the TALISMAN_HOME etc are set up too)

harinee avatar Jun 23 '20 18:06 harinee

Hi @harinee , Thank you for looking into the issue.

well, it was running when i installed it the first time. but the build started failing and that's when i decided to run it locally, and it started to fail.

OS and version? - Ubuntu 18.04
What steps did you follow to install the talisman binary?
      - curl --silent  https://raw.githubusercontent.com/thoughtworks/talisman/master/global_install_scripts/install.bash > /tmp/install_talisman.bash && /bin/bash /tmp/install_talisman.bash
What happens when you run talisman --scan ? (I am guessing it should give the same output, but please confirm, so that we know the TALISMAN_HOME etc are set up too)
     - same as the output ive pasted above.
    - TALISMAN_HOME  is the default one: $HOME/.talisman/bin

alreichf avatar Jun 23 '20 20:06 alreichf

I have the exact same setup, but it works fine for me. Could it be specific to the repo you are running the scan against? Since it worked fine before, and then it started failing, maybe the new code in the repo now consists of something that makes talisman fail? @alreichf could you please try this on another repo and see if you see the same type of a failure? Also, talisman --version gives you v1.3.0 ?

@vhasus @dineshba Any other ideas of getting this to be reproduced? I am unable to.

harinee avatar Jun 24 '20 05:06 harinee

Hi @harinee , Thank you for looking into the issue

i tried what you said and i guess its a problem with the Repo. but could this be a bug because it should just scan the repo right?

please find listed below the logs:

~/.talisman/bin/talisman_linux_amd64 --version talisman v1.3.0 alreichf@alreichf-VirtualBox:~/TESTINGTALISMAN/ALLOCCATIONSWEB-GIT$ ~/.talisman/bin/talisman_linux_amd64 --scan

d8888b. db db d8b db d8b db d888888b d8b db d888b .d8888. .o88b. .d8b. d8b db 88 8D 88 88 888o 88 888o 88 88' 888o 88 88' Y8b 88' YP d8P Y8 d8' 8b 888o 88 88oobY' 88 88 88V8o 88 88V8o 88 88 88V8o 88 88 8bo. 8P 88ooo88 88V8o 88 888b 88 88 88 V8o88 88 V8o88 88 88 V8o88 88 ooo Y8b. 8b 88~~~88 88 V8o88 88 88. 88b d88 88 V888 88 V888 .88. 88 V888 88. ~8~ db 8D Y8b d8 88 88 88 V888 db db 88 YD ~Y8888P' VP V8P VP V8P Y888888P VP V8P Y888P 8888Y' `Y88P' YP YP VP V8P VP VP

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]: talisman/scanner.getBlobsFromChannel(0xc000131b90, 0xc00017e1e0) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:59 +0x360 talisman/scanner.getBlobsInCommit(0xc0) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:38 +0xfe talisman/scanner.GetAdditions(0x8971a9, 0xe, 0x8936d1) /home/travis/gopath/src/github.com/thoughtworks/talisman/scanner/scanner.go:17 +0x37 main.(*Runner).Scan(0xc0000cbd78, 0x0, 0x0, 0xed73e8) /home/travis/gopath/src/github.com/thoughtworks/talisman/runner.go:54 +0x8f main.run(0xb8f120, 0xc000010018, 0x0, 0x894c5e, 0x8, 0x0, 0x0, 0x1, 0x0, 0x0, ...) /home/travis/gopath/src/github.com/thoughtworks/talisman/talisman.go:119 +0x703 main.main() /home/travis/gopath/src/github.com/thoughtworks/talisman/talisman.go:99 +0x53e alreichf@alreichf-VirtualBox:~/TESTINGTALISMAN/ALLOCATIONSWEB-GIT$ cd - /home/alreichf/TESTINGTALISMAN/todo-api alreichf@alreichf-VirtualBox:~/TESTINGTALISMAN/allocations-api$ ~/.talisman/bin/talisman_linux_amd64 --scan

d8888b. db db d8b db d8b db d888888b d8b db d888b .d8888. .o88b. .d8b. d8b db 88 8D 88 88 888o 88 888o 88 88' 888o 88 88' Y8b 88' YP d8P Y8 d8' 8b 888o 88 88oobY' 88 88 88V8o 88 88V8o 88 88 88V8o 88 88 8bo. 8P 88ooo88 88V8o 88 888b 88 88 88 V8o88 88 V8o88 88 88 V8o88 88 ooo Y8b. 8b 88~~~88 88 V8o88 88 88. 88b d88 88 V888 88 V888 .88. 88 V888 88. ~8~ db 8D Y8b d8 88 88 88 V888 db db 88 YD ~Y8888P' VP V8P VP V8P Y888888P VP V8P Y888P 8888Y' `Y88P' YP YP VP V8P VP VP

Please check 'talisman_reports/data' folder for the talisman scan report

alreichf@alreichf-VirtualBox:~/TESTINGTALISMAN/allocations-api$

alreichf avatar Jun 24 '20 09:06 alreichf

@alreichf yes, talisman is still supposed to scan the repo, whichever state it is in. Something in the repo must have triggered this error though. It's hard to tell what it could have been without checking the delta between the state at which talisman worked fine to where it started throwing the index out of range exception. Is there any hint that you can find?

I have tried about 5-7 repos on my end on a linux box, and all of them worked fine. @vhasus @dineshba any other ideas we can try out for debugging?

harinee avatar Jun 24 '20 21:06 harinee

Added test for scanner method which is getting panic...

Able to reproduce the same error only if we change TAB to spaces in https://github.com/thoughtworks/talisman/blob/test-for-scanner/scanner/scanner_test.go#L12-L13... Same error panic: runtime error: index out of range [1] with length 1

@alreichf Could please share sample results of below commands:

$ git ls-tree -r HEAD
$ #and
$ git ls-tree -r HEAD | grep "\t"

dineshba avatar Jul 14 '20 03:07 dineshba

@dineshba great idea on how to try to simulate the behavior 😄 When looking at https://git-scm.com/docs/git-ls-tree#_output_format which is what is used to put the blobs in the channel it specifies the tab as the last separator. I therefore assume that this is unlikely to be the reason. I tried to scan talisman (latest master) on an empty repo which worked fine. Would it be a good idea to ask for the git version in the issue template? Just to make sure that when trying to reproduce bugs its not due to subtle differences in git versions. How unlikely that may be 🙂 @alreichf do you have any new information on this issue? Have you tried @dineshba suggestion?

teleivo avatar Apr 16 '21 04:04 teleivo