New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False sh engine positives on elf binaries #339
Comments
This was an interesting one! Yes, the type-of-engine check is fairly stupid. You've analysed the situation completely correct. I think, however, it should actually be better to check for the ELF magic at the start of the file instead, and return a high match value in that case. The ELF parser already does that, so something like
Should do the trick. I'm by an OSX computer right now, so I haven't actually tested it, but I think it should work fine on both Linux and FreeBSD. Forgot to mention: Good debugging, not easy to identify! |
Agreed; that sounds better! |
* This is a trivial disturbance to the test to correct a spurious kcov error; see SimonKagstrom/kcov#339 * Closes RobotLocomotion#14424
* This is a trivial disturbance to the test to correct a spurious kcov error; see SimonKagstrom/kcov#339 * Closes RobotLocomotion#14424
* Separate out the unit test for the degenerate case * This is a trivial disturbance to the test to correct a spurious kcov error; see SimonKagstrom/kcov#339 * Closes #14424
I've pushed a fix for this with 4425833, so closing. Sorry for the immense delay. |
@jwnimmer-tri I also saw that I left a comment above unterminated so that it said "Good debugging, not!". I've updated it with the full string so that it doesn't sound as an insult. I intended it as a compliment, sorry about that! |
Thanks, I appreciate the fix! (And yes, I took your debugging comment as a typo, with no ill will.) |
Our current version of kcov on bionic has a bug SimonKagstrom/kcov#339 that generatues spurious failures based on the bitwise contents of target binaries. Temporarily deactivate kcov testing of this test to avoid one such spurious failure.
Our current version of kcov on bionic has a bug SimonKagstrom/kcov#339 that generatues spurious failures based on the bitwise contents of target binaries. Temporarily deactivate kcov testing of this test to avoid one such spurious failure.
Our current version of kcov on bionic has a bug SimonKagstrom/kcov#339 that generates spurious failures based on the bitwise contents of target binaries. Temporarily deactivate kcov testing of this test to avoid one such spurious failure.
First off, thanks for the wonderful tool. We use it daily.
As I understand it, kcov uses
EngineFactory
withmatchFile
to heuristically infer which engine to use for a given coverage target. This causes a problem when the first 80 bytes of an ELF binary contain the characterssh
:kcov/src/engines/bash-engine.cc
Lines 404 to 405 in c18c775
In a recent project of mine, I ended up with a C++ binary that was incorrectly detected as shell:
Here is the header of the binary:
Notice the "sh" bytes in the
e_shoff
section of the ELF header.I have attached the binary (and its required shared library) here: kcov-repro.zip. This binary is intended to run on Ubuntu 20.04.
It's source code is at https://github.com/RobotLocomotion/drake/blob/04e5c5b014d5d621c4a1e445afbc37f2d2e59c58/perception/test/point_cloud_flags_test.cc, though the failure mode is very sensitive to the compilation flags being used.
Here is a link to my CI failure: https://drake-jenkins.csail.mit.edu/view/Production/job/linux-focal-gcc-bazel-nightly-coverage/153/ -- note that this data will expire within a few weeks.
I'd like to request a way to opt-out of the heuristic engine detection, on the command line. Either by disabling certain engines, or forcing one specific engine always.
I'm using kcov as provided by Ubuntu 20.04, at version
38+dfsg-1
.The text was updated successfully, but these errors were encountered: