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

Runtime Error #84

Closed
fineguy opened this issue Jul 24, 2017 · 5 comments · Fixed by #86
Closed

Runtime Error #84

fineguy opened this issue Jul 24, 2017 · 5 comments · Fixed by #86

Comments

@fineguy
Copy link

fineguy commented Jul 24, 2017

When I try to process https://github.com/willfarrell/Browsers I get the following error:

panic: runtime error: index out of range

goroutine 1 [running]:
gopkg.in/src-d/enry%2ev1.getInterpreter(0xc42198d080, 0x81, 0x281, 0x12, 0xbec0a0)
        /tmp/enry-dfekhdox/src/gopkg.in/src-d/enry.v1/common.go:289 +0x396
gopkg.in/src-d/enry%2ev1.GetLanguagesByShebang(0xc4200ea28a, 0x12, 0xc42198d080, 0x81, 0x281, 0xbeb730, 0x0, 0x0, 0x0, 0x0, ...)
        /tmp/enry-dfekhdox/src/gopkg.in/src-d/enry.v1/common.go:270 +0x43
gopkg.in/src-d/enry%2ev1.GetLanguages(0xc4200ea28a, 0x12, 0xc42198d080, 0x81, 0x281, 0x0, 0x0, 0xc420e3cd60)
        /tmp/enry-dfekhdox/src/gopkg.in/src-d/enry.v1/common.go:126 +0x127
gopkg.in/src-d/enry%2ev1.GetLanguage(0xc4200ea28a, 0x12, 0xc42198d080, 0x81, 0x281, 0x0, 0x0)
        /tmp/enry-dfekhdox/src/gopkg.in/src-d/enry.v1/common.go:38 +0x53
main.main.func1(0xc4200ea230, 0x6c, 0xbbd740, 0xc421d17a00, 0x0, 0x0, 0x0, 0x0)
        /tmp/enry-dfekhdox/src/gopkg.in/src-d/enry.v1/cli/enry/main.go:80 +0x664
path/filepath.walk(0xc4200ea230, 0x6c, 0xbbd740, 0xc421d17a00, 0xc4209915f0, 0x0, 0x0)
        /usr/lib/go-1.8/src/path/filepath/path.go:351 +0x81
path/filepath.walk(0xc4215483c0, 0x59, 0xbbd740, 0xc421d17930, 0xc4209915f0, 0x0, 0x0)
        /usr/lib/go-1.8/src/path/filepath/path.go:376 +0x414
path/filepath.walk(0xc4215482a0, 0x53, 0xbbd740, 0xc421d17860, 0xc4209915f0, 0x0, 0x0)
        /usr/lib/go-1.8/src/path/filepath/path.go:376 +0x414
path/filepath.walk(0xc420bd5d60, 0x4a, 0xbbd740, 0xc421d17790, 0xc4209915f0, 0x0, 0x0)
        /usr/lib/go-1.8/src/path/filepath/path.go:376 +0x414
path/filepath.walk(0xc420173680, 0x33, 0xbbd740, 0xc420954a90, 0xc4209915f0, 0x0, 0x30)
        /usr/lib/go-1.8/src/path/filepath/path.go:376 +0x414
path/filepath.Walk(0xc420173680, 0x33, 0xc4209915f0, 0x0, 0xc4209915c0)
        /usr/lib/go-1.8/src/path/filepath/path.go:398 +0x14c
main.main()

Here is the full log:
stderr.txt

@zurk
Copy link

zurk commented Jul 24, 2017

The same for me for this repo: https://github.com/mjirik/lisa
srderr.txt

@bzz
Copy link
Contributor

bzz commented Jul 24, 2017

@fineguy @zurk great report, it's always nice to have full logs attached.

Usually, adding precise instructions on how to reproduce the issue usually speeds up it's fix by maintainers.

@mcarmonaa That's what I tried, both resulted in panic + exit code 2 (which reminded of #40)

#remove old version
rm -rf $GOPATH/gopkg.in/src-d/enry.v1
rm -rf $GOPATH/bin/enry
which enry
# enry not found

go get gopkg.in/src-d/enry.v1/...

git clone --depth 1 https://github.com/mjirik/lisa.git  && cd lisa
enry
 # panic: runtime error: index out of range
echo $?
 # 2

panic: runtime error: index out of range is reproducible for both repositories for me.

@bzz
Copy link
Contributor

bzz commented Jul 25, 2017

Update:

Minimal reproducible example:

wget https://raw.githubusercontent.com/mjirik/lisa/master/tests/ubuntu_installer_test.sh
enry ubuntu_installer_test.sh

panic: runtime error: index out of range

Seems like something to do with .sh files starting with #!


with latest build of enry

cd ~$GOPATH/src/gopkg.in/src-d/
rm -rf enry.v1
git clone https://github.com/src-d/enry.git enry.v1
make build-cli
cp enry ~$GOPATH/bin

enry -h
  enry v1.3.2 build: 07-25-2017_09_24_59 commit: 7cd8904, based on linguist commit: 37979b2
  enry, A simple (and faster) implementation of github/linguist

Narrow it down to 4 files from lisa repository above:

find . -type f -not -path "./.git/*" | xargs -I{} enry {} 2>&1 |  grep -c "panic: runtime error: index out of range"

https://github.com/mjirik/lisa/blob/master/applications/LISA.app/Contents/MacOS/lisa
https://github.com/mjirik/lisa/blob/master/installer.sh
https://github.com/mjirik/lisa/blob/master/lisa.sh
https://github.com/mjirik/lisa/blob/master/tests/ubuntu_installer_test.sh

@bzz
Copy link
Contributor

bzz commented Jul 25, 2017

@zurk @fineguy please, feel free to try enry build from #86 and let me know if that fixes the issue for you.

@fineguy
Copy link
Author

fineguy commented Jul 25, 2017

@bzz works like a charm for me, thx!

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

Successfully merging a pull request may close this issue.

3 participants