facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.8k stars 2k forks source link

Dockerfile: US-ASCII locale causes crash on UTF-8 input #1786

Open pjonsson opened 11 months ago

pjonsson commented 11 months ago

I built the docker image for 1.1.0 according to the instructions. This sequence of commands:

git clone https://github.com/contiki-ng/cooja
docker run -it -v ./cooja:/cooja infer /bin/bash
# Inside container
apt remove openjdk-11-jdk-headless
apt autoremove
apt update
apt install openjdk-17-jdk-headless
cd cooja
infer run -- ./gradlew build

ends with the output:

...
exited with code 1

Error backtrace:
Raised at Base__String.index_from_exn_internal in file "src/string.ml", line 96, characters 7-22
Called from Base__String.lsplit2_exn.lsplit2_exn in file "src/string.ml", line 610, characters 14-54
Called from Base__String.lsplit2 in file "src/string.ml", line 628, characters 11-33
Re-raised at IBase__Die.raise_error.do_raise in file "src/base/Die.ml" (inlined), line 26, characters 8-56
Called from IBase__Logging.die.(fun) in file "src/base/Logging.ml", line 347, characters 6-39
Called from Integration__Gradle.capture_gradle_target in file "src/integration/Gradle.ml", line 91, characters 2-45
Called from IBase__ProcessPool.child_loop in file "src/base/ProcessPool.ml", line 352, characters 12-19
Re-raised at IStdlib__IExn.reraise_if in file "src/istd/IExn.ml" (inlined), line 18, characters 15-63
Called from IBase__ProcessPool.child_loop in file "src/base/ProcessPool.ml", line 354, characters 10-427
Called from IBase__ProcessPool.child_loop in file "src/base/ProcessPool.ml" (inlined), line 333, characters 19-1023
Called from IBase__ProcessPool.child_loop in file "src/base/ProcessPool.ml" (inlined), line 333, characters 19-1023
Called from IBase__ProcessPool.child_loop in file "src/base/ProcessPool.ml" (inlined), line 333, characters 19-1023
Called from IBase__ProcessPool.fork_child in file "src/base/ProcessPool.ml", line 414, characters 6-99
Called from Stdlib__array.init in file "array.ml", line 54, characters 22-27
Called from IBase__ProcessPool.create in file "src/base/ProcessPool.ml", line 438, characters 4-178
Called from Backend__Tasks.Runner.create in file "src/backend/Tasks.ml" (inlined), line 25, characters 6-286
Called from Integration__Gradle.run_infer_capture in file "src/integration/Gradle.ml", line 96, characters 2-207
Called from Integration__Driver.capture in file "src/integration/Driver.ml", line 133, characters 6-32
Called from IBase__Utils.timeit in file "src/base/Utils.ml", line 429, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 79, characters 29-44
Called from Integration__Driver.capture.(fun) in file "src/integration/Driver.ml", line 159, characters 2-233
Called from Backend__GCStats.log_f in file "src/backend/GCStats.ml" (inlined), line 90, characters 10-14
Called from Integration__Driver.capture in file "src/integration/Driver.ml", line 157, characters 2-288
Called from Dune__exe__Infer.run in file "src/infer.ml" (inlined), line 20, characters 2-36
Called from IBase__Utils.timeit in file "src/base/Utils.ml" (inlined), line 429, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 79, characters 29-44
Called from Dune__exe__Infer.run in file "src/infer.ml", line 25, characters 22-94

Setting ENV LANG=en_US.UTF-8 and installing the locales package (for en_US.UTF-8) according to these instructions:

https://serverfault.com/questions/362903/how-do-you-set-a-locale-non-interactively-on-debian-ubuntu/801162#801162

in the Dockerfile made the analysis complete.