Yeah, I don't really get what's going on here that Devel::Cover is unhappy
about.

Maybe it's something about how my mkstemps_real() implementation creates
the filehandle that it returns.  I see perlxstut(1) now talks about
{Input,InOut,Output}Stream and PerlIO* in the typemap, so maybe I should
change it to skip the newGVgen()+sv_bless() dance, switch from PPCODE: to
CODE: with a return type of InOutStream, and return the PerlIO_fdopen()
result?

(I also suspect it should be using mkostemps(..., O_CLOEXEC), given how
newer perls have switched to setting the close-on-exec flag by default in
the low-level calls, but it's 100% unclear to me what perl's expectations
are for the close-on-exec flag of an fd returned to it by an XS.)

Philip


On Sun, Jul 9, 2023 at 12:30 PM Andrew Hewus Fresh <and...@afresh1.com>
wrote:

> On Sat, Jul 08, 2023 at 12:09:01PM -0700, Andrew Hewus Fresh wrote:
> > On Sat, Jul 08, 2023 at 11:18:00AM +0200, Marc Espie wrote:
> > > Hey, Philip, you wrote this a long time ago.
> > >
> > > Now, I'm trying to get some coverage out of Devel::Cover on pkg_add,
> > > and somehow, it gets in the way.
> > >
> > > # perl -MDevel::Cover=+select,OpenBSD/.* /usr/sbin/pkg_add random_run
> > <snip>
> > >               the problem was:
> > >
> > > Found type 9 GLOB(0x64a7292fc10), but it is not representable by the
> Sereal encoding format at
> /usr/local/libdata/perl5/site_perl/amd64-openbsd/Devel/Cover/DB/IO/Sereal.pm
> line 46.
> > >
> > >
> > > I have zero idea if Devel::Cover is to blame or if OpenBSD::MkTemp is
> missing
> > > some magic annotation to cover for _GEN_1, _GEN_2, but the end result
> is
> > > that NO coverage data gets written, none at all (I suspect some missing
> > > annotations, see below)
> >
> > Same, especially when I can't reproduce on my laptop that needs to be
> > updated or on my sparc64 that just got updated today:
>
>
> I take that back, running the same command as root I see the same
> problem.
>
> However, trying to reproduce with a simple case doesn't show me the same
> issue, so not quite sure what Devel::Cover is trying to store.
>
> $ cat mktemp.pl
> #!/usr/bin/perl
> use v5.36;
>
> use OpenBSD::MkTemp qw< mkstemp mkdtemp >;
>
> sub output($fh, $content) {
>         print $fh $content;
> }
>
> my $d = mkdtemp("fooXXXXXXXXX");
> my ($fh, $file) = mkstemp("fooXXXXXXXXX");
>
> output($fh, "Hello World\n");
>
> close $fh;
>
> $ doas perl -MDevel::Cover=+select,OpenBSD.* ./mktemp.pl
>
> This version of Devel::Cover was built with Perl version 5.036000.
> It is now being run with Perl version 5.036001.
> Attempting to make adjustments, but you may find that some of your modules
> do
> not have coverage data collected.  You may need to alter the +-inc,
> +-ignore
> and +-select options.
>
> Devel::Cover 1.40: Collecting coverage data for branch, condition, pod,
> statement, subroutine and time.
> Selecting packages matching:
>     OpenBSD.*
> Ignoring packages matching:
>     /Devel/Cover[./]
> Ignoring packages in:
>     /usr/local/libdata/perl5/site_perl/sparc64-openbsd
>     /usr/local/libdata/perl5/site_perl
>     /usr/libdata/perl5/sparc64-openbsd
>     /usr/libdata/perl5
> Devel::Cover: Deleting old coverage for changed file mktemp.pl
> Devel::Cover: getting BEGIN block coverage
> Devel::Cover: 100% - 0s taken
> Devel::Cover: getting CHECK block coverage
> Devel::Cover: 100% - 0s taken
> Devel::Cover: getting END/INIT block coverage
> Devel::Cover: 100% - 0s taken
> Devel::Cover: getting CV coverage
> Devel::Cover: 100% - 0s taken
> Devel::Cover: Writing coverage database to
> /tmp/x/cover_db/runs/1688930470.15647.20075
> ---------------------------- ------ ------ ------ ------ ------ ------
> ------
> File                           stmt   bran   cond    sub    pod   time
> total
> ---------------------------- ------ ------ ------ ------ ------ ------
> ------
> ...openbsd/OpenBSD/MkTemp.pm   77.7   25.0   25.0   83.3    0.0    0.7
>  61.7
> mktemp.pl                     100.0    n/a    n/a  100.0    n/a   99.3
> 100.0
> Total                          87.5   25.0   25.0   88.8    0.0  100.0
>  74.5
> ---------------------------- ------ ------ ------ ------ ------ ------
> ------
>
>

Reply via email to