The check function for filetests avoids treating '-t stat' as a pair of
stackable filetests, but needs also to avoid treating 'stat -t' as
stackable.
}
if ((PL_hints & HINT_FILETEST_ACCESS) && OP_IS_FILETEST_ACCESS(o->op_type))
o->op_private |= OPpFT_ACCESS;
- if (PL_check[kidtype] == Perl_ck_ftst
- && kidtype != OP_STAT && kidtype != OP_LSTAT) {
+ if (type != OP_STAT && type != OP_LSTAT
+ && PL_check[kidtype] == Perl_ck_ftst
+ && kidtype != OP_STAT && kidtype != OP_LSTAT
+ ) {
o->op_private |= OPpFT_STACKED;
kid->op_private |= OPpFT_STACKING;
if (kidtype == OP_FTTTY && (
${^WIN32_SLOPPY_STAT} = 0;
}
-plan tests => 113;
+plan tests => 115;
my $Perl = which_perl();
is $w, undef, 'no unopened warning from stat _';
}
+{
+ # [perl #123816]
+ # Inappropriate stacking of l?stat with filetests should either work or
+ # give a syntax error, they shouldn't crash.
+ eval { stat -t };
+ ok(1, 'can "stat -t" without crashing');
+ eval { lstat -t };
+ ok(1, 'can "lstat -t" without crashing');
+}
+
END {
chmod 0666, $tmpfile;
unlink_all $tmpfile;