From: Nikolai Eipel Date: Sat, 29 Jan 2005 16:52:53 +0000 (+0100) Subject: Patch for Perlbug #4253 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=25988e07f3c5c5717930b897625a3e6119c92879;p=p5sagit%2Fp5-mst-13.2.git Patch for Perlbug #4253 Message-Id: <200501291652.53841.eipel@web.de> (-T and -B invalidate _ filehandle when no read permission on file) plus a regression test p4raw-id: //depot/perl@23986 --- diff --git a/pp_sys.c b/pp_sys.c index bb843e1..c943c08 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3464,7 +3464,6 @@ PP(pp_fttext) sv = POPs; really_filename: PL_statgv = Nullgv; - PL_laststatval = -1; PL_laststype = OP_STAT; sv_setpv(PL_statname, SvPV(sv, n_a)); if (!(fp = PerlIO_open(SvPVX(PL_statname), "r"))) { diff --git a/t/op/stat.t b/t/op/stat.t index c553a16..70ab5a3 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -9,7 +9,7 @@ BEGIN { use Config; use File::Spec; -plan tests => 80; +plan tests => 82; my $Perl = which_perl(); @@ -453,6 +453,18 @@ ok( (-A _) < 0, 'negative -A works'); ok( (-C _) < 0, 'negative -C works'); ok(unlink($f), 'unlink tmp file'); +{ + ok(open(F, ">", $tmpfile), 'can create temp file'); + close F; + chmod 0077, $tmpfile; + my @a = stat($tmpfile); + my $s1 = -s _; + -T _; + my $s2 = -s _; + is($s1, $s2, q(-T _ doesn't break the statbuffer)); + unlink $file; +} + END { 1 while unlink $tmpfile; }