Skip to content

Commit 508aafd

Browse files
committed
bisect-runner.pl: When did warnings clear up
Illustrate bisection to identify commit at which run-time warnings ceased being emitted from a program.
1 parent 92ef216 commit 508aafd

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Porting/bisect-runner.pl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,59 @@ =head2 When did perl stop segfaulting on certain code?
10941094
10951095
=back
10961096
1097+
=head2 When did perl stop emitting warnings when running on certain code?
1098+
1099+
=over 4
1100+
1101+
=item * Background
1102+
1103+
Most of the time, we bisect in order to identify the first "bad" commit: the
1104+
first time code failed to compile; the first time the code emitted warnings;
1105+
and so forth.
1106+
1107+
Some times, however, we want to identify the first "good" commit: the point
1108+
where the code began to compile; the point where the code no longer emitted
1109+
warnings; etc.
1110+
1111+
We can use this program for that purpose, but we have to reverse our sense of
1112+
"good" and "bad" commits. In this case, F<git> will label the healing commit
1113+
as "bad" (or label a breaking commit as "good"), so we have to invoke the
1114+
program such that we do a C<die> when we reach the healing commit.
1115+
1116+
=item * Problem
1117+
1118+
It was reported that in an older version of Perl, a warning was being emitted
1119+
when a program was using the F<bigrat> module and
1120+
C<Scalar::Util::looks_like_number()> was called passing a non-integral number
1121+
(I<i.e.,> a rational).
1122+
1123+
$ perl -wE 'use Scalar::Util; use bigrat;
1124+
say "mercy" if Scalar::Util::looks_like_number(1/9);'
1125+
1126+
In perl-5.32, this emitted:
1127+
1128+
$ Argument "1/9" isn't numeric in addition (+) at
1129+
/usr/local/lib/perl5/5.32/Math/BigRat.pm line 1955.
1130+
mercy
1131+
1132+
But it was observed that there was no warning in perl-5.36.
1133+
1134+
=item * Solution
1135+
1136+
$ perl Porting/bisect.pl \
1137+
--start=5624cfff8f \
1138+
--end=b80b9f7fc6 \
1139+
-we 'use Scalar::Util; use bigrat; my @w;
1140+
local $SIG{__WARN__} = sub { push @w, $_; };
1141+
print "mercy\n" if Scalar::Util::looks_like_number(1/9);
1142+
die unless @w;'
1143+
1144+
=item * Reference
1145+
1146+
L<GH issue 20685|https://github.com/Perl/perl5/issues/20685>
1147+
1148+
=back
1149+
10971150
=cut
10981151

10991152
# Ensure we always exit with 255, to cause git bisect to abort.

0 commit comments

Comments
 (0)