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

Crashes when run from a particular directory #181

Closed
joshlf opened this issue Jul 8, 2020 · 3 comments
Closed

Crashes when run from a particular directory #181

joshlf opened this issue Jul 8, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@joshlf
Copy link

joshlf commented Jul 8, 2020

Describe the bug
When invoking scc from a particular directory, it crashes with the following trace:

$ scc
panic: runtime error: index out of range [41] with length 41

goroutine 34 [running]:
github.com/boyter/scc/processor.codeState(0xc0003bf500, 0x16, 0x37, 0x2, 0xc000a03348, 0x0, 0x0, 0xc000a03348, 0x0, 0x0, ...)
	/private/tmp/scc-20200303-44083-y6ns73/scc-2.12.0/src/github.com/boyter/scc/processor/workers.go:194 +0x730
github.com/boyter/scc/processor.CountStats(0xc0003bf500)
	/private/tmp/scc-20200303-44083-y6ns73/scc-2.12.0/src/github.com/boyter/scc/processor/workers.go:431 +0xdca
github.com/boyter/scc/processor.processFile(0xc0003bf500, 0xc001f0a620)
	/private/tmp/scc-20200303-44083-y6ns73/scc-2.12.0/src/github.com/boyter/scc/processor/workers.go:707 +0x27c
github.com/boyter/scc/processor.fileProcessorWorker.func1(0xc000236300, 0xc0001ebd08, 0xc0001ebd10, 0xc0001ebd18, 0xc000236360, 0xc0001ebd20)
	/private/tmp/scc-20200303-44083-y6ns73/scc-2.12.0/src/github.com/boyter/scc/processor/workers.go:648 +0x284
created by github.com/boyter/scc/processor.fileProcessorWorker
	/private/tmp/scc-20200303-44083-y6ns73/scc-2.12.0/src/github.com/boyter/scc/processor/workers.go:624 +0xfb

To Reproduce

Unfortunately, the code that I was running this on is proprietary, and I wasn't able to find a root cause, but I'm hoping that this stack trace might help point somebody else in the right direction.

Note that, when running scc from the parent directory or from any subdirectory, it works fine. The crash only happens when cd'd into this one directory in particular.

Desktop (please complete the following information):

  • OS: macOS
  • Version: 2.12.0
@boyter boyter self-assigned this Jul 9, 2020
@boyter boyter added the bug Something isn't working label Jul 9, 2020
@boyter
Copy link
Owner

boyter commented Jul 9, 2020

I have been meaning to fuzz test the internals of the matcher. This might be the time.

I don't suppose you could at least tell me what languages you have in that directory? Would making tracking this down a bit easier.

It sounds like its something being ignored by your gitignore or ignore files though since it only cashes when you enter that directory which might help work out the offending file.

@joshlf
Copy link
Author

joshlf commented Jul 10, 2020

Sure!

File extensions
$ find . -type f | rev | cut -d . -f 1 | rev | grep -v / | grep -v _ | sort -u
1
APACHE2
BSD
DOCS
MD
MIT
Makefile
S
TXT
a
aar
aidl
android
apk
babelrc
bak
bash
bat
bazel
bin
bnf
bplist
buckconfig
bundle
bzl
c
cc
clang-format
class
clj
cljs
cmd
coffee
command
config
cpp
cpuprofile
cs
csproj
css
d
def
dex
dll
dockerignore
editorconfig
emd
entitlements
env
eslintignore
eslintrc
exe
filters
fish
flat
flow
flowconfig
fs
fsproj
git
gitattributes
gitignore
gitkeep
gitmodules
gnu
go
gql
gradle
groovy
gson
gv
gyp
gypi
gz
h
hash
hbs
html
huskyrc
icns
ico
idl
iml
info
input
ios
jar
java
jpg
js
jscodeshiftignore
jscsrc
jshintrc
json
json5
keep
keystore
kml
kt
l
lock
log
ls
m
map
markdown
md
md5
mf
mjs
mk
mm
modulemap
name
nib
node
npmignore
nvmrc
o
opts
patch
pb
pbxproj
pch
pdf
peg
pegjs
php
plist
png
podspec
pom
prefs
prettierrc
pro
profmap
project
projitems
properties
props
py
ratignore
rawproto
rb
rtf
s
sbt
scala
ser
sh
sha1
shproj
sln
snap
so
sql
stack
store
storyboard
strings
styl
svg
swift
tfl
tflite
toml
ts
tsbuildinfo
tsx
ttf
txt
vcxproj
vm
watchmanconfig
wav
web
xcconfig
xcscheme
xcsettings
xcuserstate
xcworkspacedata
xib
xml
yml
yy
zip
zsh
Top-level `.gitignore`:
$ cat ../.gitignore 
.DS_Store
.vscode/ipch
.idea
node_modules
yarn-error.log
netlifyctl-debug.log
.test_cache
dist
.hprof
.env
packages/customer/ios/Pods/
packages/customer/ios/@numi/
packages/customer/ios/assets/
packages/customer/node_modules
packages/shopkeeper/node_modules

boyter added a commit that referenced this issue Aug 10, 2020
@boyter
Copy link
Owner

boyter commented Aug 10, 2020

Hacky fix put in which should resolve this.

@boyter boyter closed this as completed Aug 10, 2020
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

2 participants