-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
configuration: fix incorrect handling of relative executables #419
configuration: fix incorrect handling of relative executables #419
Conversation
Some doubts about the code:
|
@SimonKagstrom can you add it to the The CI tests also reported an error for If I remember correctly, this error was introduced with this change; when testing locally for commit 011ad7f this error did not occurred. |
If you wish, but I haven't been strict at all with this!
I don't think it really matters: This is just done for parsing the arguments at startup, which should be very quick however it's implemented. The bulk of the processing time will anyway be in collecting coverage, so I think your implementation will be fine! |
I've merged the python2 packages for github actions in master, so it should now be possible to rebase this PR. |
Thanks. But the workflow for FreeBSD is taking too much time (2h 33m). It is printing boot messages in a loop ... I think it is better to add a shorter timeout to the |
2356d42
to
446bfb9
Compare
Rebased to master, so that python2 is available. |
The FreeBSD support in github actions seems fickle, unfortunately. I don't use FreeBSD myself, so it's quite a hassle to fix it when it breaks. However, it at least has nothing to do with your change, so that should be mergeable anyhow! |
... and only one test fails now. Unfortunately, that one works fine for me, so I'm not quite sure what happens there. |
https://github.com/SimonKagstrom/kcov/actions/runs/8221592577/job/22482125233?pr=419 is still running, even after I pushed a change. This seems a serious issue with the FreeBSD image, maybe it is better to send a bug report to Github. |
But why the test case name mentions i386? The CPU architecture should have nothing to do with symlinks. |
Hehe, almost but not quite :-) It's issue_368, not 386, and it refers a regression test of Issue #368 in kcov. I'll write a separate bug report for FreeBSD, although I don't think github themselves have anything to do with it. |
.... No, actually your last push was correctly built for FreeBSD. However, it also (now) lacks python2, so that needs to be installed. Alternatively, I guess we can make the Python2 tests Linux-only. That part should be the same on FreeBSD etc anyway. Basically this change:
|
From https://github.com/SimonKagstrom/kcov/actions/runs/8221592577/job/22482125233?pr=419, you can see that the FreeBSD images hangs on "Run startVM". When I checked the log messages I found that the boot messages are printed, then boot starts again ... forever. |
I found where the problems are:
UPDATE The culprit is
|
Commit 720eb98 (configuration: refactorize code scanning for executables) introduced a bug when the executable is a relative path. In this case the file is always expanded, thus causing file to be always considered non executable by the code scanning through the parameters in configuration.cc. Update the look_path function to first try a file without consulting the PATH environment variable. Add the find_executable function, and update the code to check the file is not a directory instead of checking if it is a regular file, so that symlinks are handled correctly. Update the peek_file function to do the same, so that ParseManager can handle symlinks correctly. The old code worked because the last argument (before the executable arguments) was update correctly thanks to the loop over the PATH environment variable. Note that the correct solution is to add "--" before the executable arguments, but this will break the kcov cli interface.
446bfb9
to
b587483
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #419 +/- ##
==========================================
+ Coverage 65.60% 65.81% +0.21%
==========================================
Files 58 58
Lines 4504 4520 +16
Branches 4161 4177 +16
==========================================
+ Hits 2955 2975 +20
+ Misses 1549 1545 -4 ☔ View full report in Codecov by Sentry. |
This should really fix the implementation. It was a good think that I decided to refactorize the old code; the code was wrong but it still worked correctly. |
By the way, there are unit tests in the |
The FreeBSD image has still problems:
|
Very good that you found the error! If you expand the commands in the FreeBSD logs, you can see the errors. It's the Python2 issue (plus a build issue in the tests, which should also link to curl). I think that will be resolved by my Python2 patch above, which makes these tests Linux-only. |
The unittests have probably rotted away, but to build them, you should just run cmake against the tests/unit-tests directory (make sure you've done |
The only error I see is Error: The process '/bin/bash' failed with exit code 64 after I also found an interesting log message from skipping non-regular file "kcov/kcov/tests/python/link_main" Why does FreeBSD setup use |
Maybe only I can see it, but there's a I believe the FreeBSD virtual machine gets the code via rsync from the Mac it runs on, but I'm not quite sure how it's setup. Anyway, if you're happy with the changes, I can merge your PR and fix the FreeBSD tests later, or else you could try adding my patch to disable python2 for it. |
By "adding" do you mean amending the current commit or add a new commit? UPDATE: @SimonKagstrom
From a quick search, the |
Let's keep that as a separate issue. It really has nothing to do with your change. I'll start with merging that, and resolve the FreeBSD problem in the other issue. May thanks for all the fixes! |
Commit 720eb98 (configuration: refactorize code scanning for executables) introduced a bug when the executable is a relative path. In this case the file is always expanded, thus causing file to be always considered non executable by the code scanning through the parameters in
configuration.cc
.Update the
look_path
function to first try a file without consulting thePATH
environment variable.The old code worked because the last argument (before the executable arguments) was update correctly thanks to the loop over the
PATH
environment variable.Note that the correct solution is to add "--" before the executable arguments, but this will break the
kcov
cli interface.This change should restore the original behavior.
What's left is to actually fix #414.