4 ms·
A tool to detect bugs in Java and C/C++/Objective-C code before it ships
- rwmj 5y agoSeveral previous postings about this tool, but only a single comment on this one: https://news.ycombinator.com/item?id=27469454 https://news.ycombinator.com/item?id=27469454
- dmolony 5y agoWarning: infer has been deprecated because it does not build!
- murkle 5y agoLooks active (as of 8 days ago) https://github.com/facebook/infer https://github.com/facebook/infer
- pabs3 5y agoWhat build error do you get? Maybe post an issue on their GitHub?
- hmottestad 5y agohttps://github.com/facebook/infer/issues/1607 https://github.com/facebook/infer/issues/1607
- jillesvangurp 5y agoHow does this compare to other static code analyzers like spotbugs for Java and Kotlin? Does it have some unique capabilities?
- hmottestad 5y agoIt's developed by Facebook/Meta. I would hope that means it has been found to be useful internally, otherwise it would probably not still be under development.
- hmottestad 5y agoAlas it does not install on my mac (M1). Their getting started guide says to use homebrew to install Infer. Homebrew says that Infer has been deprecated because it does not build and that there are no bottles available (homebrew lingo for package). Installing (building) from source doesn't work either :(
- pabs3 5y agoWhat build error do you get? Maybe post an issue on their GitHub?
- hmottestad 5y agohttps://github.com/facebook/infer/issues/1607 https://github.com/facebook/infer/issues/1607
- pabs3 5y agoThat would be the homebrew error, what about the source build error?
- rwmj 5y agoIt's apparently quite tricky to build because it requires a patched clang. Someone I know is trying to build it for Fedora: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/XIPQOQQBST6HORQ3JUZ3CSWU3BEUTIPI/ https://lists.fedoraproject.org/archives/list/devel@lists.fe...
- Jaxan 5y agoIt is based on separation logic. And apparently this makes it scale at the size of Facebook. IIRC, the tool runs in every commit. Also, I think each tool finds different bugs, they have a different set of false positives/negatives. So it’s good to be familiar with multiple tools.
- adamretter 5y agoI would also like to see some more concrete information about how it compares to older established tools like FindBugs and PMD. I took a look at their Documentation but there is no mention of other such tools.
- belter 5y agoFrom the Docs: Overview of the issue types currently reported by Infer https://fbinfer.com/docs/all-issue-types https://fbinfer.com/docs/all-issue-types
- jokoon 5y agoCompilers should really implement such thing... Can't it be a GCC extension or something?
- pabs3 5y agoThere is the GCC static analyzer and the LLVM equivalent: https://lwn.net/Articles/869880/ https://lwn.net/Articles/869880/ https://gcc.gnu.org/onlinedocs/gccint/Static-Analyzer.html https://gcc.gnu.org/onlinedocs/gccint/Static-Analyzer.html https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11/ https://developers.redhat.com/blog/2021/01/28/static-analysi... https://clang-analyzer.llvm.org/scan-build.html https://clang-analyzer.llvm.org/scan-build.html
- jsteemann 5y agoClang's scan-build supports C++ for a long time already. Regarding gcc/g++, there seems to be support only for C. From https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer: > Initial implementation was added in GCC 10; major rewrite occurred in GCC 11. > Only C is currently supported (I hope to support C++ in GCC 13, but it is out-of-scope for GCC 12) Looking forward to seeing C++ support added to it!
- rwmj 5y agoI've found loads of bugs in the C support and David has been very responsive to my bug reports, even substantially reworking how realloc(3) was being handled because of a case we found. (Edit: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99260 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99260 - I must get around to testing his fix since GCC 12 is in Fedora now)
- bregma 5y agoWhy? Oh, I understand. There are two kinds of engineers: the lumpers and the dividers. The lumpers like to build one single massive engine that does everything, and the dividers prefer many small engines that do one thing, do it very well, and can be composed with other small engines in new and innovative ways and provide redundancy, maintainability, and scalability. Obviously I count myself in the latter group. So the question for me is, what possible advantage would consolidating everything into one tool give me? Consider that I'm a software development toolchain engineer by trade in your reply.
- wiradikusuma 5y agoIt doesn't seem to have FAQ, so does anyone know if it supports JVM-languages e.g. Kotlin and Scala?
- vips7L 5y agoNo windows build and no plugins for popular editors. I’ll stick with sonarlint/qube.
- pjmlp 5y agoVC++ analyser + SAL is also quite good, and keeping checked iterators on, even release builds, while not Ada/Rust, is already much better than not using anything.
- xvilka 5y agoTo everyone interested - since recently[1] it supports SARIF[2] output, thus could be easily integrated[3] with the GitHub. [1] https://github.com/facebook/infer/commit/9ec6cef8d1f48462919eff3e6758bb6a4f9a230e https://github.com/facebook/infer/commit/9ec6cef8d1f48462919... [2] http://docs.oasis-open.org/sarif/sarif/v2.0/csprd01/sarif-v2.0-csprd01.html http://docs.oasis-open.org/sarif/sarif/v2.0/csprd01/sarif-v2... [3] https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github https://docs.github.com/en/code-security/code-scanning/integ...
- jsteemann 5y agoI stumbled across fbinfer and gave it a try for a larger C++ project on Linux a few days ago. It worked out of the box, because fbinfer can tap into the compile commands database that can easily be generated by CMake and other build tools. The tool has nice output about its current progress, but even when running with many threads, its long translation and analysis durations made it somewhat impractical to use on a large project. I understand that later it can run with incremental changes, and can reuse some data from previous runs. In this case it probably may be better suited. But the first-time analysis of a large project is very time-consuming. I am not saying this is unique to fbinfer. Other static analyzers tend to have the same problem. To be fair, I haven't yet inspected the tool's various options, which can potentially speed up the analysis. The initial report the tool created contained several findings. Mainly "potential" nullptr dereferences and a few "potential" data races. After manual inspection these all turned out to be false positives. However, the tool also found several dead stores, which turned out to be actual dead stores. So it is at least helpful w.r.t. From my perspective, the tool has potential. Probably some of the false positives can be turned off via configuration, and using it for incremental analysis may also reduce its runtime so that it becomes tolerable for larger projects.
- phyzix5761 5y agoIntellij seems to have something similar built in.