rizsotto / scan-build

Clang's scan-build re-implementation in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No string format value in exception handler

fukanchik opened this issue · comments

This line
https://github.com/rizsotto/scan-build/blob/master/libscanbuild/analyze.py#L411

produces strange result scan-build: analysis failed: %s:

[10:25:05] :		 [Running make for a flat makefile] scan-build: analysis failed: %s
[10:25:05] :		 [Running make for a flat makefile] Traceback (most recent call last):
[10:25:05] :		 [Running make for a flat makefile]   File "scripts/cppcore/scan-build/venv/lib/python3.4/site-packages/libscanbuild/analyze.py", line 405, in run_analyzer
[10:25:05] :		 [Running make for a flat makefile]     output = run_command(cmd, cwd=cwd)
[10:25:05] :		 [Running make for a flat makefile]   File "scripts/cppcore/scan-build/venv/lib/python3.4/site-packages/libscanbuild/__init__.py", line 78, in run_command
[10:25:05] :		 [Running make for a flat makefile]     raise ex
[10:25:05] :		 [Running make for a flat makefile]   File "scripts/cppcore/scan-build/venv/lib/python3.4/site-packages/libscanbuild/__init__.py", line 74, in run_command
[10:25:05] :		 [Running make for a flat makefile]     stderr=subprocess.STDOUT)
[10:25:05] :		 [Running make for a flat makefile]   File "/python-3.4/lib/python3.4/subprocess.py", line 617, in check_output
[10:25:05] :		 [Running make for a flat makefile]     raise CalledProcessError(retcode, process.args, output=output)
[10:25:05] :		 [Running make for a flat makefile] subprocess.CalledProcessError: Command '['/llvm/3.8.0/bin/clang', '-cc1', '-triple', 'x86_64-unknown-linux-gnu', '-analyze', '-disable-free', '-main-file-name', 'applog_wrap.c', '-analyzer-store=region', '-analyzer-opt-analyze-nested-blocks', '-analyzer-eagerly-assume', '-analyzer-checker=core', '-analyzer-checker=unix', '-analyzer-checker=deadcode', '-analyzer-checker=security.insecureAPI.UncheckedReturn', '-analyzer-checker=security.insecureAPI.getpw', '-analyzer-checker=security.insecureAPI.gets', '-analyzer-checker=security.insecureAPI.mktemp', '-analyzer-checker=security.insecureAPI.mkstemp', '-analyzer-checker=security.insecureAPI.vfork', '-analyzer-checker=nullability.NullPassedToNonnull', '-analyzer-checker=nullability.NullReturnedFromNonnull', '-analyzer-output', 'plist', '-w', '-mrelocation-model', 'pic', '-pic-level', '2', '-mthread-model', 'posix', '-mdisable-fp-elim', '-fmath-errno', '-masm-verbose', '-mconstructor-aliases', '-munwind-tables', '-fuse-init-array', '-target-cpu', 'x86-64', '-target-linker-version', '2.23.52.0.1', '-dwarf-column-info', '-debug-info-kind=limited', '-dwarf-version=3', '-debugger-tuning=gdb', '-femit-coverage-notes', '-femit-coverage-data', '-resource-dir', '/llvm/3.8.0/bin/../lib/clang/3.8.0', '-I', '.', '-I', '/lmdb-0.9.21/include', '-I', '/libuv-1.14.1/include', '-I', '/libssh2-1.7.0/include', '-I', '/datastax-cpp-driver-2.7.1/GCC481-ReleaseMT64/include', '-D', 'VERSION="Compiled: 2018-04-09:10:02:54 ; Branch: master ; Rev: ddcc26a06f0de3abd36758874e1999a6b859a939 ; Changes:  M ../../../../../../project.list  M ../../../apps/test_seq_retrieval/Makefile.test_seq_retrieval.app  M ../../../hgvs/M"', '-I', '../../../../../../include', '-I', '../../../../../../include/internal', '-I', '.', '-I', '/c++.by-date/20180409/src/internal/variation/services/allele-reg/cassandra', '-D', '_DEBUG', '-D', '_LARGEFILE_SOURCE', '-D', '_FILE_OFFSET_BITS=64', '-D', '_LARGEFILE64_SOURCE', '-D', '_MT', '-D', '_REENTRANT', '-D', '_THREAD_SAFE', '-I', '/c++.by-date/20180409/GCC493-Debug64MT/inc', '-I', '/c++.by-date/20180409/include', '-I', '/c++.by-date/20180409/include/internal', '-internal-isystem', '/include', '-internal-isystem', '/llvm/3.8.0/bin/../lib/clang/3.8.0/include', '-internal-externc-isystem', '/include', '-internal-externc-isystem', '/usr/include', '-Wno-format-y2k', '-std=gnu11', '-fdebug-compilation-dir', '/export/home/tomcat/TeamCity/Agent2/work/fe8faf996ae511bb/cassandra', '-ferror-limit', '19', '-fmessage-length', '0', '-pthread', '-fgnu89-inline', '-fobjc-runtime=gcc', '-fdiagnostics-show-option', '-analyzer-opt-analyze-headers', '-analyzer-output=plist', '-o', '/export/home/tomcat/TeamCity/Agent2/work/fe8faf996ae511bb/analyzer_reports/scan-build-2018-04-09-10-00-59-007056-b3ob93w1/report-vqpxq2dn.plist', '-x', 'c', '/export/home/tomcat/TeamCity/Agent2/work/fe8faf996ae511bb/applog_wrap.c']' returned non-zero exit status 1

This is because no value is supplied for %s.

Minimal code to reproduce this:

import logging

logging.basicConfig()

try:
    raise Exception("AAAA")
except:
    logging.warning("X=%s", exc_info=True)

produces

WARNING:root:X=%s
Traceback (most recent call last):
  File "2/x.py", line 6, in <module>
    raise Exception("AAAA")
Exception: AAAA

Thanks for the report. (Closed it by accidentally) Will look at it later.