-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
kcov --python-parser=python3 hangs if python3 is not installed #250
Comments
Thanks for the detailed analysis! Pull-request coming up? I'll fix it myself otherwise. I guess it would also be good to check if the command actually exists first, and bail out if it doesn't. |
I'm not preparing a PR for this right now. I'm focusing on getting ptrace support to work on FreeBSD. |
OK, I'll fix it myself! Pleased to hear that you're working on FreeBSD support! I've thought about it myself, but don't run any of the BSDs. |
Fixed with 2651b54, at least partially. The fix is only partial in the sense that it checks if the python parser exists in the PATH (or via an absolute path). It could still hang if something bad but existing is passed to the command. The other end of the pipe is in a Python script ( Leaving open for now, although it should not be as bad as before. |
Thanks! |
Hi @SimonKagstrom, for the work on issue #458 I looked at how both the python and bash engines invoke the script under test. This approach would also make argument handling in
Note that Using
If this is a reasonable approach, I'd be happy to work a PR here. |
@jack-rann sounds like a great idea! Thanks for the findings and explanation of them, and a PR would be great! |
@jack-rann I suppose this should be closed now as well, after your PR #466 ? |
Not yet, @SimonKagstrom. PR #466 only affected Bash. I’ll start on this Python issue once I return next week. |
Will plan to implement the same argument processing and Existing Python tests should be adequate for the Manually invoking unmodified
Execution of the new |
After code modification, Manual execution of test script above now succeeds. Note that the embedded single quote character in an argument is now properly handled:
Local execution of Python related tests succeed:
CI tests on GitHub pass for changes made on this branch. https://github.com/jack-rann/kcov/actions/runs/11087951720 Will open PR shortly. |
Running
kcov --python-parser=python3
hangs if python3 is not installed. The worst part is thatSIGTERM
is insufficient to kill kcov, onlySIGKILL
will work. The hang is caused by the parent attempting to open a named pipe inPythonEngine::start
on this line:kcov/src/engines/python-engine.cc
Line 110 in 88e2804
However, the child has already exited 6 lines above. Since the child never opened its end of the named pipe,
fopen
never returns.One way to fix this bug would be to use
pipe(2)
to open an already-connected pair of pipes instead ofmkfifo
. Then one end of the opened pipe could be passed to the child. When the child dies, the other end of the pipe would getEPIPE
instead of hanging.I've reproduced this issue on Debian 9.3 and FreeBSD 11.1. The easiest way to reproduce it, on a system that may or may not have python3 installed, is to simply provide a bogus name for the python interpreter, like this:
kcov /tmp/kcov --python-parser=python4 tests/python/main 5
The text was updated successfully, but these errors were encountered: