pilosus / action-pip-license-checker

GitHub Action for license compliance: Python, JavaScript, iOS, Android and more.
MIT License
44 stars 2 forks source link

NumberFormatException with too long patch numbers #43

Closed jmfernandez closed 1 year ago

jmfernandez commented 1 year ago

I have this action integrated in one of my Python projects, so each time a push is done, it checks the licences of the needed Python packages. The list is obtained through pip freeze.

The point is that the issue described at https://github.com/pilosus/pip-license-checker/issues/136 has started happening due a too long patch number in an indirect dependency (in this case schema-salad-8.4.20230213094415).

Once the issue is fixed at https://github.com/pilosus/pip-license-checker in a newer release, could you also release an update of the action using that newer release, please? Current one is using 0.44.0

https://github.com/pilosus/action-pip-license-checker/blob/941b76dd138ba125db40753243e1751a8c01ca55/Dockerfile#L1

Thanks in advance!

pilosus commented 1 year ago

Hi @jmfernandez thanks for reporting. Can you please check if your problem is solved with this?

uses: pilosus/action-pip-license-checker@8dab363961dde61d6036887e4dc2ee43f5bfd598

If yes, feel free to use it if the matter is urgent. Because I'll need more time to prep the proper release for the action, as the upstream checker had some potentially breaking changes when migrating from version 0.44 to 0.45.0. It's unlikely that I'll be able to release it until the next week or two. But using the action with the commit rather than tag should help to solve your problem.

jmfernandez commented 1 year ago

Hi @pilosus , First of all, thanks for the hotfix! I have tried the action, and the original issue has disappeared. But now it is complaining by something different I cannot narrow down to a concrete line:

/usr/bin/docker run --name c04424036fa058a4e4bf29d2ba1ef91c384bb_434f98 --label 6c0442 --workdir /github/workspace --rm -e "pythonLocation" -e "PKG_CONFIG_PATH" -e "Python_ROOT_DIR" -e "Python2_ROOT_DIR" -e "Python3_ROOT_DIR" -e "LD_LIBRARY_PATH" -e "INPUT_REQUIREMENTS" -e "INPUT_FAIL" -e "INPUT_EXCLUDE" -e "INPUT_EXTERNAL" -e "INPUT_EXTERNAL-FORMAT" -e "INPUT_EXTERNAL-OPTIONS" -e "INPUT_FAILS-ONLY" -e "INPUT_EXCLUDE-LICENSE" -e "INPUT_PRE" -e "INPUT_TOTALS" -e "INPUT_WITH-TOTALS" -e "INPUT_TOTALS-ONLY" -e "INPUT_HEADERS" -e "INPUT_TABLE-HEADERS" -e "INPUT_FORMATTER" -e "INPUT_GITHUB-TOKEN" -e "INPUT_VERBOSE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/WfExS-backend/WfExS-backend":"/github/workspace" 6c0442:4036fa058a4e4bf29d2ba1ef91c384bb  "constraints-3.11.txt" "" "" "" "StrongCopyleft" "" "pylint.*" "" "" "" "" "" "" "" "" "" ""
Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 08
    at java.base/java.util.concurrent.FutureTask.report(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
    at clojure.core$deref_future.invokeStatic(core.clj:2317)
    at clojure.core$future_call$reify__8544.deref(core.clj:7041)
    at clojure.core$deref.invokeStatic(core.clj:2337)
    at clojure.core$pmap$step__8557$fn__8561.invoke(core.clj:7092)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$concat$fn__5558.invoke(core.clj:727)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$map$fn__5935.invoke(core.clj:2763)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$map$fn__5935.invoke(core.clj:2763)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:713)
    at clojure.core$next__5451.invokeStatic(core.clj:64)
    at clojure.core.protocols$fn__8249.invokeStatic(protocols.clj:169)
    at clojure.core.protocols$fn__8249.invoke(protocols.clj:124)
    at clojure.core.protocols$fn__8204$G__8199__8213.invoke(protocols.clj:19)
    at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
    at clojure.core.protocols$fn__8236.invokeStatic(protocols.clj:75)
    at clojure.core.protocols$fn__8236.invoke(protocols.clj:75)
    at clojure.core.protocols$fn__8178$G__8173__8191.invoke(protocols.clj:13)
    at clojure.core$reduce.invokeStatic(core.clj:6886)
    at clojure.core$frequencies.invokeStatic(core.clj:7271)
    at pip_license_checker.core$get_totals.invokeStatic(core.clj:50)
    at pip_license_checker.core$get_report.invokeStatic(core.clj:71)
    at pip_license_checker.core$_main.invokeStatic(core.clj:266)
    at pip_license_checker.core$_main.doInvoke(core.clj:255)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at pip_license_checker.core.main(Unknown Source)
Caused by: java.lang.NumberFormatException: Invalid number: 08
    at clojure.lang.LispReader.readNumber(LispReader.java:352)
    at clojure.lang.LispReader.read(LispReader.java:278)
    at clojure.lang.LispReader.read(LispReader.java:216)
    at clojure.lang.LispReader.read(LispReader.java:205)
    at clojure.lang.RT.readString(RT.java:1876)
    at clojure.lang.RT.readString(RT.java:1871)
    at clojure.core$read_string.invokeStatic(core.clj:3816)
    at pip_license_checker.version$parse_number_BANG_.invokeStatic(version.clj:122)
    at pip_license_checker.version$validate_version$fn__4332.invoke(version.clj:189)
    at clojure.core$map$fn__5935.invoke(core.clj:2770)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:44)
    at clojure.core$vec.invokeStatic(core.clj:379)
    at pip_license_checker.version$validate_version.invokeStatic(version.clj:188)
    at pip_license_checker.version$parse_version.invokeStatic(version.clj:221)
    at pip_license_checker.version$parse_version.invoke(version.clj:202)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at pip_license_checker.pypi$api_simple_get_releases$fn__4436.invoke(pypi.clj:91)
    at clojure.core$map$fn__5935.invoke(core.clj:2772)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$filter$fn__5962.invoke(core.clj:2826)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$filter$fn__5962.invoke(core.clj:2826)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:58)
    at clojure.lang.RT.seq(RT.java:535)
    at clojure.core$seq__5467.invokeStatic(core.clj:139)
    at clojure.core$sort.invokeStatic(core.clj:3114)
    at pip_license_checker.version$sort_versions.invokeStatic(version.clj:551)
    at pip_license_checker.version$sort_versions.doInvoke(version.clj:546)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at pip_license_checker.version$get_version.invokeStatic(version.clj:567)
    at pip_license_checker.pypi$api_get_project.invokeStatic(pypi.clj:105)
    at pip_license_checker.pypi$requirement__GT_dep.invokeStatic(pypi.clj:200)
    at pip_license_checker.pypi$get_parsed_deps$fn__4467.invoke(pypi.clj:235)
    at clojure.core$pmap$fn__8552$fn__8553.invoke(core.clj:7089)
    at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
    at clojure.lang.AFn.call(AFn.java:18)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

The constraints file which leads to this is available at https://github.com/inab/WfExS-backend/blob/b058b538f3334a4b8c657a541dc9b9fb40434f55/constraints-3.11.txt

I have been able to reproduce it locally through the the docker image:

docker run --rm -ti -v "/tmp/WfExS-backend":"/github/workspace" pilosus/pip-license-checker:0.46.0 java -jar app.jar --exclude 'pylint.*' --requirements /github/workspace/constraints-3.11.txt

Hope this helps!

jmfernandez commented 1 year ago

I have been able to narrow it down to the specific case of pycparser==2.21, as I have just described at https://github.com/pilosus/pip-license-checker/issues/138

pilosus commented 1 year ago

@jmfernandez should be fixed with:

uses: pilosus/action-pip-license-checker@d574bc40bf5b18db8920ad4fff1ee376abb6db28

let me know if it solves both bugs

jmfernandez commented 1 year ago

I can confirm you it fixes the issue with the action.

Thanks!