infer icon indicating copy to clipboard operation
infer copied to clipboard

inferTraceBugs error

Open sencho opened this issue 9 years ago • 8 comments

When I run inferTraceBugs command at below two cases, error happens.

Infer Version:v0.10.0, install through brew.

Case1: Command:

inferTraceBugs --html

Error:

Traceback (most recent call last):
  File "/usr/local/bin/inferTraceBugs", line 396, in <module>
    main()
  File "/usr/local/bin/inferTraceBugs", line 372, in main
    generate_html_report(args, reports)
  File "/usr/local/bin/inferTraceBugs", line 350, in generate_html_report
    bug_trace_file.write(html_bug_trace(args, bug, i))
  File "/usr/local/bin/inferTraceBugs", line 281, in html_bug_trace
    bug_trace += str(tracer)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 245: ordinal not in range(128)

Case2: Command:

inferTraceBugs

Error:

Choose report to display (default=0): 0
Choose maximum level of nested procedures calls (default=max): 0

CSMBP/CSMBP-KOBE/CSMBP-Core/CSHybird/CSNativeObject.m:61: warning: DIRECT_ATOMIC_PROPERTY_ACCESS
  Direct access to ivar _delegate of an atomic property at line 61, column 77. Accessing an ivar of an atomic property makes the property nonatomic
Traceback (most recent call last):
  File "/usr/local/bin/inferTraceBugs", line 396, in <module>
    main()
  File "/usr/local/bin/inferTraceBugs", line 392, in main
    utils.stdout(str(tracer))
  File "/usr/local/Cellar/infer/0.10.0/lib/infer/infer/lib/python/inferlib/utils.py", line 311, in stdout
    print(encode(s, errors=errors))
  File "/usr/local/Cellar/infer/0.10.0/lib/infer/infer/lib/python/inferlib/utils.py", line 293, in encode
    return u.encode(encoding=config.CODESET, errors=errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 362: ordinal not in range(128)

sencho avatar Feb 27 '17 10:02 sencho

Thanks for the report. Could you please paste the contents of infer-out/toplevel.log?

jvillard avatar Feb 27 '17 13:02 jvillard

I installed Infer v0.9.3 manaully before

[INFO] output of locale.getdefaultlocale(): ('zh_CN', 'UTF-8')
[INFO] encoding we chose in the end: UTF-8
[INFO] Running command /Users/sencho/infer-osx-v0.9.3/infer/bin/../lib/python/infer.py -j 4 --out /Users/sencho/Code/CSMBP-iOS/infer-out --project_root /Users/sencho/Code/CSMBP-iOS -- xcodebuild -workspace CSMBP.xcworkspace -scheme CSMBP-Debug -sdk iphonesimulator10.1 -configuration Debug
[INFO] Path to infer script /Users/sencho/infer-osx-v0.9.3/infer/bin/../lib/python/infer.py (/Users/sencho/infer-osx-v0.9.3/infer/lib/python/infer.py)
[INFO] 
[INFO] Platform: Darwin-16.1.0-x86_64-i386-64bit
[INFO] PATH=/Users/sencho/.sdkman/candidates/gradle/current/bin:/Users/sencho/infer-osx-v0.9.3/infer/bin:/Users/sencho/.opam/system/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[INFO] SHELL=/bin/zsh
[INFO] PWD=/Users/sencho/Code/CSMBP-iOS
[INFO] Xcode version:
Xcode 8.1
Build version 8B62

[INFO] clang version:
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

[INFO] Capture phase was successful
[INFO] Starting analysis
[INFO] Aggregating stats
[INFO] 

sencho avatar Feb 27 '17 14:02 sencho

Does 0.9.3 also crash with the same error?

jvillard avatar Feb 27 '17 15:02 jvillard

Already removed,but echo the $PATH display below,there is no "infer-osx-v0.9.3".

/Users/sencho/.nvm/versions/node/v6.9.2/bin:/Users/sencho/.sdkman/candidates/gradle/current/bin:/Users/sencho/.opam/system/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

sencho avatar Feb 27 '17 15:02 sencho

Can you paste toplevel.log after running infer 0.10.0 and making inferTraceBugs crash?

jvillard avatar Feb 27 '17 15:02 jvillard

I removed toplevel.log and run inferTraceBugs --html, these is no toplevel.log file. and error is:

Traceback (most recent call last):
  File "/usr/local/bin/inferTraceBugs", line 396, in <module>
    main()
  File "/usr/local/bin/inferTraceBugs", line 372, in main
    generate_html_report(args, reports)
  File "/usr/local/bin/inferTraceBugs", line 350, in generate_html_report
    bug_trace_file.write(html_bug_trace(args, bug, i))
  File "/usr/local/bin/inferTraceBugs", line 281, in html_bug_trace
    bug_trace += str(tracer)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 245: ordinal not in range(128)

sencho avatar Feb 27 '17 15:02 sencho

I didn't mean that you should remove toplevel.log, it's generated by infer and not inferTraceBugs, but it would still be helpful here.

jvillard avatar Mar 06 '17 14:03 jvillard

I managed to reproduce the bug with one of the tests in infer, I think (trace and error is similar):

$ cd infer/tests/build_systems/utf8_in_procname
$ make test
...
$ inferTraceBugs --html
Traceback (most recent call last):
  File "/home/jul/infer/infer/bin/inferTraceBugs", line 396, in <module>
    main()
  File "/home/jul/infer/infer/bin/inferTraceBugs", line 372, in main
    generate_html_report(args, reports)
  File "/home/jul/infer/infer/bin/inferTraceBugs", line 350, in generate_html_report
    bug_trace_file.write(html_bug_trace(args, bug, i))
  File "/home/jul/infer/infer/bin/inferTraceBugs", line 281, in html_bug_trace
    bug_trace += str(tracer)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xec in position 148: ordinal not in range(128)

I'll work on a fix.

jvillard avatar Mar 06 '17 15:03 jvillard