SimonKagstrom / kcov

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
http://simonkagstrom.github.io/kcov/
GNU General Public License v2.0
720 stars 110 forks source link

bash engine does not output nor drain stdout with recent bash #323

Closed dciabrin closed 4 years ago

dciabrin commented 4 years ago

I want to check code coverage of bash scripts that act as agents in a cluster manager [1]. Those scripts are regularly called by the cluster manager, and sometimes return some xml output under regular operation.

Unfortunately, since #249, when a bash script is being instrumented by kcov, its stdout is ignored altogether (with recent bash, which seems to be what everyone uses these days). So I cannot use kcov transparently anymore and gather coverage data.

Another side effect of #249 is that since nothing is draining stdout of the instrumented process, that process could get stuck in output and never finish successfully. For instance, kcov currently hangs on this bash script:

#!/bin/sh
dd if=/dev/urandom of=/dev/stdout bs=65536 count=2 2>/dev/null | base64 -w0

[1] https://github.com/ClusterLabs/resource-agents/ for the record

SimonKagstrom commented 4 years ago

Thanks a lot for debugging and fixing this!

Closing since your pull request has been merged.