$ ./perl -Ilib -e '$/=*foo; <>; warn' <./perl
Assertion failed: (!isGV_with_GP(_svcur)), function Perl_mess_sv, file util.c, line 1467.
Abort trap
The assertion happens when ‘<...> line 42’ is being appended to
the message.
The line of code in question is this:
const bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
It uses this macro in perl.h:
#define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
which was last modified by commit
af7d13df559:
-#define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
-#define RsPARA(sv) (SvOK(sv) && ! SvCUR(sv))
+#define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
+#define RsPARA(sv) (SvPOK(sv) && ! SvCUR(sv))
So it looks as though it has always called SvCUR on something that is
not necessarily a PV. As of commit
af7d13df559, it has also called
SvPVX on a potential non-PV.
Fixing this simply involves using SvPV instead of SvPVX.
I don’t know that t/io/open.t is the best place for the test, but all
the other ‘<...> line 42’ tests are there.
use warnings;
use Config;
-plan tests => 119;
+plan tests => 120;
my $Perl = which_perl();
open($fh3{k}, "TEST");
gimme($fh3{k});
like($@, qr/<\$fh3\{...}> line 1\./, "autoviv fh lexical helem");
+
+ local $/ = *F; # used to cause an assertion failure
+ gimme($fh3{k});
+ like($@, qr/<\$fh3\{...}> chunk 2\./,
+ '<...> line 1 when $/ is set to a glob');
}
SKIP: {
if (GvIO(PL_last_in_gv) && (SvTYPE(GvIOp(PL_last_in_gv)) == SVt_PVIO)
&& IoLINES(GvIOp(PL_last_in_gv)))
{
+ STRLEN l;
const bool line_mode = (RsSIMPLE(PL_rs) &&
- SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
+ *SvPV_const(PL_rs,l) == '\n' && l == 1);
Perl_sv_catpvf(aTHX_ sv, ", <%"SVf"> %s %"IVdf,
SVfARG(PL_last_in_gv == PL_argvgv
? &PL_sv_no