jpeddicord / askalono

A tool & library to detect open source licenses from texts
Apache License 2.0
255 stars 25 forks source link

Askalono errors without output #74

Closed amznpurple closed 2 years ago

amznpurple commented 2 years ago

Sometimes I've found that askalono will exit with 1 and this message:

askalono --format json identify --optimize /tmp/whatever.py
{"path":"/tmp/whatever.py","error":"Confidence threshold not high enough for any known license"}

I don't think it should return 1 in this case, since the program is returning successfully an error message about what it did.

Secondly and more importantly:

Inside this jar (use unzip to open) https://repo1.maven.org/maven2/net/sourceforge/streamsupport/streamsupport/1.5.3/streamsupport-1.5.3-sources.jar File: lang/Doubles.java

Run askalono on it. No output but returns 1 as exit code. askalono --format json identify --optimize /tmp/Doubles.java

All of this is 100% reproducible.

Thanks!

/cc @hyandell

jpeddicord commented 2 years ago

Hiya! Sorry for the slow reply.

Sometimes I've found that askalono will exit with 1 and this message: askalono --format json identify --optimize /tmp/whatever.py {"path":"/tmp/whatever.py","error":"Confidence threshold not high enough for any known license"} I don't think it should return 1 in this case, since the program is returning successfully an error message about what it did.

The intent was an easy way to identify whether a license was detected; JSON output or not, hence the exit code. This isn't really something I'd like to change at this point -- doing so would break backwards compat and I know other project use this binary in scripts as well.

File: lang/Doubles.java Run askalono on it. No output but returns 1 as exit code.

Found it: this file is slightly corrupt.

❯❯❯ iconv -f utf8 ~/Doubles.java -t utf8 -o /dev/null
iconv: illegal input sequence at position 1944

Line 48, specifically, has a bad Unicode codepoint. image

askalono should not be silently failing; however. Fixing that up.

jpeddicord commented 2 years ago

Released 0.4.6 with a fix for the latter. Closing this out.