Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Dec 2020 04:10:31 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 251552] lang/perl5-5.32.0_1 Test::More like()
Message-ID:  <bug-251552-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D251552

            Bug ID: 251552
           Summary: lang/perl5-5.32.0_1 Test::More like()
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: dpchrist@holgerdanske.com

Created attachment 220202
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D220202&action=
=3Dedit
tarball containing hello and bug.t scripts

As I understand it, Test::More is included with Perl 5.


like() works as expected on Debian GNU/Linux and Windows 7/ Cygwin:

2020-12-02 19:56:33 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ cat /etc/debian_version
10.6

2020-12-02 19:56:51 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ uname -a
Linux dipsy 4.19.0-12-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64
GNU/Linux

2020-12-02 19:56:54 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ perl -v

This is perl 5, version 28, subversion 1 (v5.28.1) built for
x86_64-linux-gnu-thread-multi
(with 65 registered patches, see perl -V for more detail)

Copyright 1987-2018, Larry Wall

Perl may be copied only under the terms of either the Artistic License or t=
he
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


2020-12-02 19:56:56 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ perl -MCapture::Tiny -e 'print $Capture::Tiny::VERSION, "\n"'
0.48

2020-12-02 19:57:00 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ cat hello=20
#!/usr/bin/env perl
# $Id: hello,v 1.1 2020/12/03 03:18:56 dpchrist Exp $

use strict;
use warnings;

use Getopt::Long;
use Pod::Usage;

our %opt;

GetOptions(\%opt, 'man') or die;

pod2usage(-exitstatus =3D> 0, -verbose =3D> 2) if $opt{man};

print "hello, world!\n";

__END__

=3Dhead1 NAME

 hello - "hello, world!" with manual page option

=3Dhead1 SYNOPSIS

 hello [--man]

=3Dhead1 AUTHOR

David Paul Christensen dpchrist@holgerdanske.com

=3Dhead1 LICENSE

Public Domain

=3Dcut

2020-12-02 19:57:03 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ cat bug.t=20
# $Id: bug.t,v 1.1 2020/12/03 03:18:56 dpchrist Exp $
# by David Paul Christensen dpchrist@holgerdanske.com
# Public Domain.

use strict;
use warnings;

use Capture::Tiny qw(
    capture
);
use File::Basename;
use File::Spec::Functions;
use FindBin qw(
    $Bin
);
use Test::More;

my $script =3D catfile $Bin, 'hello';

my $basename =3D basename $script;
my $stderr;
my $stdout;
my $retval;

($stdout, $stderr, $retval)  =3D capture {
    system $^X, "-I$FindBin::Bin/../lib", $script, '--man'
};
like
    $stdout,
    qr{NAME.+$basename.+SYNOPSIS}s,
    "case " . __LINE__;
is $stderr, '', "case " . __LINE__;
is $retval, 0, "case " . __LINE__;

done_testing;

2020-12-02 19:57:05 dpchrist@dipsy ~/sandbox/perl/capture-system-like
$ perl bug.t=20
ok 1 - case 31
ok 2 - case 32
ok 3 - case 33
1..3


like() does not work as expected on FreeBSD (and macOS/Darwin):

2020-12-02 19:59:05 toor@vf1 ~/sandbox/perl/capture-system-like
# freebsd-version=20
12.1-RELEASE-p10

2020-12-02 19:59:12 toor@vf1 ~/sandbox/perl/capture-system-like
# uname -a
FreeBSD vf1.tracy.holgerdanske.com 12.1-RELEASE-p10 FreeBSD 12.1-RELEASE-p10
GENERIC  amd64

2020-12-02 19:59:13 toor@vf1 ~/sandbox/perl/capture-system-like
# perl -v

This is perl 5, version 32, subversion 0 (v5.32.0) built for
amd64-freebsd-thread-multi

Copyright 1987-2020, Larry Wall

Perl may be copied only under the terms of either the Artistic License or t=
he
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


2020-12-02 19:59:15 toor@vf1 ~/sandbox/perl/capture-system-like
# perl -MCapture::Tiny -e 'print $Capture::Tiny::VERSION, "\n"'
0.48

2020-12-02 19:59:17 toor@vf1 ~/sandbox/perl/capture-system-like
# cat hello=20
#!/usr/bin/env perl
# $Id: hello,v 1.1 2020/12/03 03:18:56 dpchrist Exp $

use strict;
use warnings;

use Getopt::Long;
use Pod::Usage;

our %opt;

GetOptions(\%opt, 'man') or die;

pod2usage(-exitstatus =3D> 0, -verbose =3D> 2) if $opt{man};

print "hello, world!\n";

__END__

=3Dhead1 NAME

 hello - "hello, world!" with manual page option

=3Dhead1 SYNOPSIS

 hello [--man]

=3Dhead1 AUTHOR

David Paul Christensen dpchrist@holgerdanske.com

=3Dhead1 LICENSE

Public Domain

=3Dcut

2020-12-02 19:59:19 toor@vf1 ~/sandbox/perl/capture-system-like
# cat bug.t=20
# $Id: bug.t,v 1.1 2020/12/03 03:18:56 dpchrist Exp $
# by David Paul Christensen dpchrist@holgerdanske.com
# Public Domain.

use strict;
use warnings;

use Capture::Tiny qw(
    capture
);
use File::Basename;
use File::Spec::Functions;
use FindBin qw(
    $Bin
);
use Test::More;

my $script =3D catfile $Bin, 'hello';

my $basename =3D basename $script;
my $stderr;
my $stdout;
my $retval;

($stdout, $stderr, $retval)  =3D capture {
    system $^X, "-I$FindBin::Bin/../lib", $script, '--man'
};
like
    $stdout,
    qr{NAME.+$basename.+SYNOPSIS}s,
    "case " . __LINE__;
is $stderr, '', "case " . __LINE__;
is $retval, 0, "case " . __LINE__;

done_testing;

2020-12-02 19:59:20 toor@vf1 ~/sandbox/perl/capture-system-like
# perl bug.t=20
not ok 1 - case 31
#   Failed test 'case 31'
#   at bug.t line 28.
#                   'HELLO(1)              User Contributed Perl Documentat=
ion=20
           HELLO(1)
#=20
#=20
#=20
#=20
# NAME
#         hello - "hello, world!" with manual page option
#=20
# SYNOPSIS
#         hello [--man]
#=20
# AUTHOR
#        David Paul Christensen dpchrist@holgerdanske.com
#=20
# LICENSE
#        Public Domain
#=20
#=20
#=20
# perl v5.32.0                      2020-12-03=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
HELLO(1)
# '
#     doesn't match '(?^s:NAME.+hello.+SYNOPSIS)'
ok 2 - case 32
ok 3 - case 33
1..3
# Looks like you failed 1 test of 3.


I have tested like() in isolation, and it works as expected.  Therefore, the
combination of Test::More, Capture::Tiny, and/or system may be causing the=
=20
problem (?).


The bug existed on earlier patch levels of FreeBSD 12.1, but I do not have
details.


David

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-251552-7788>