Matt Schreiber

Results 81 comments of Matt Schreiber

@stdedos -- I'm currently working implementing the solution @eugpermar describes. Will link to the WIP branch as soon as I've pushed it from my working copy.

> Couldn't you use bashcov ./validate-output.sh < ./script.sh instead of ./validate-output.sh bashcov ./script.sh to work around that issue? In the scenario you've suggested, it looks like `bashcov` would generate coverage...

Looks like this is due to the fact that Bash 4.4 does not inherit `PS4` from the environment when run as `root`. From [the Bash NEWS file](https://tiswww.case.edu/php/chet/bash/NEWS): > nn. Shells...

Turns out this is the same issue as encountered in #31.

@CyberShadow -- looks like this is due to the fact that Bashcov exports `SHELLOPTS=xtrace` into Bash's environment: ``` cat > child.sh parent.sh &2 -- '# %s\n' "$bv"; docker run -it...

> Would it make sense to make bashcov do the equivalent of bash -c "set -x ; source $script" instead of env SHELLOPTS=xtrace $script ? I think this could be...

Been playing around with FFI and https://github.com/mvdan/sh -- nothing beats Bash for parsing Bash, but `mvdan/sh` has a pretty slick interface that makes it easy to take a parse tree...

@infertux -- `dash 0.5.9.1` on Arch Linux comes with support for `$LINENO`, and I was able to get `bashcov` working with a few changes: * `$PS4` needs to use `$0`...

So it looks like it will be difficult to support POSIX shells in all but the most basic scenario of generating coverage stats for a single script. As far as...

Holy moly, TIL that [kcov](https://github.com/SimonKagstrom/kcov) is using some [`LD_PRELOAD` trickery](https://github.com/SimonKagstrom/kcov/blob/cc4f205f8683aa55c0116075701c137d50f24a99/src/engines/bash-engine.cc#L184-L186) to [override `execve` calls and inject the `-x` flag into the argument vector when the command name is `/bin/bash`, `/bin/sh`,...