Skip to content

OpenBSD: 3 unit test failures in ./miniperl -Ilib t/op/sort.t #18545

Closed
@jkeenan

Description

@jkeenan

This ticket is an attempt to more precisely specify a problem which we've been discussing in #18536, "a1325b902d breaks build on OpenBSD".

On OpenBSD, ./miniperl -Ilib t/op/sort.t generates 3 unit test failures which we do not see on other OSes and which do not fail when we run the file either via make minitest, ./perl -Ilib t/op/sort.t or cd t; ./perl harness op/sort.t; cd-.

It turns out that we can reproduce these problems in older perls. Here's output from perl-5.24.0.

$ git checkout v5.24.0
$ sh ./Configure -des -Dusedevel && make test_prep
$ ./miniperl -v | head -2 | tail -1
This is perl 5, version 24, subversion 0 (v5.24.0 (UNKNOWN-miniperl)) built for OpenBSD.amd64-openbsd

$ rm err; ./miniperl -Ilib t/op/sort.t 2>err; wc -l err
27

$ cat err
which_perl: cannot find ./miniperl from ./miniperl at ./test.pl line 842.
# Failed test 159 - RT \#72334 at ./test.pl line 1032
#      got "sh: ./miniperl: not found"
# expected "0 1 2 3"
# PROG: 
# sub w ($$) {my ($l, $r) = @_; my $v = \@_; undef @_; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0
# STATUS: 32512
# Failed test 160 - RT \#72334 at ./test.pl line 1032
#      got "sh: ./miniperl: not found"
# expected "0 1 2 3"
# PROG: 
# sub w ($$) {my ($l, $r) = @_; my $v = \@_; undef @_; @_ = 0..2; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0
# STATUS: 32512
# Failed test 167 - [perl \#77930] cx_stack reallocation during sort at ./test.pl line 1032
#      got "sh: ./miniperl: not found"
# expected "ok"
# PROG: 
# 
#    $sub = sub {
#     local $count = $count+1;
#     ()->$sub if $count < 1000;
#     $a cmp $b
#    };
#    () = sort $sub qw<a b c d e f g>;
#    print "ok"
#  
# STATUS: 32512

Each of the 3 unit test failures is associated with an invocation of fresh_perl_is() out of t/test.pl. These unit tests were first added in 2010 in the 5.13 development cycle. Not surprisingly, perl-5.14.0 is the first production release in which I've gotten these failures.

Note this error output (perl-5.24):

which_perl: cannot find ./miniperl from ./miniperl at ./test.pl line 842.
# Failed test 159 - RT \#72334 at ./test.pl line 1032
#      got "sh: ./miniperl: not found"

That suggests that the problem is some interaction between the shell, t/test.pl and the built miniperl. In the case of OpenBSD, man sh says:

     This version of sh is actually ksh in disguise.  As such, it also
     supports the features described in ksh(1).  This manual page describes
     only the parts relevant to a POSIX compliant sh.  If portability is a
     concern, use only those features described in this page.

Since this error output has helped confuse our analysis in other tickets, I would like to be able to fix the problem soon. Assistance from anyone familiar with any of OpenBSD, Korn shell, miniperl and t/test.pl will be appreciated.

For reference, here is the error output in blead (v5.33.6-44-g874732f8cc):

$ cat err
which_perl: cannot find ./miniperl from ./miniperl at ./test.pl line 864.
# Failed test 164 - RT \#72334 at ./test.pl line 1077
#      got "sh: ./miniperl: not found"
# expected "0 1 2 3"
# PROG: 
# sub w ($$) {my ($l, $r) = @_; my $v = \@_; undef @_; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0
# STATUS: 32512
# Failed test 165 - RT \#72334 at ./test.pl line 1077
#      got "sh: ./miniperl: not found"
# expected "0 1 2 3"
# PROG: 
# sub w ($$) {my ($l, $r) = @_; my $v = \@_; undef @_; @_ = 0..2; $l <=> $r}; print join q{ }, sort w 3, 1, 2, 0
# STATUS: 32512
# Failed test 172 - [perl \#77930] cx_stack reallocation during sort at ./test.pl line 1077
#      got "sh: ./miniperl: not found"
# expected "ok"
# PROG: 
# 
#    $sub = sub {
#     local $count = $count+1;
#     ()->$sub if $count < 1000;
#     $a cmp $b
#    };
#    () = sort $sub qw<a b c d e f g>;
#    print "ok"
#  
# STATUS: 32512

Thank you very much.
Jim Keenan

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions