Fix first eof() return value

This commit is contained in:
Petr Písař 2019-01-15 08:40:35 +01:00
parent 634fb4080c
commit ca28c96764
3 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,45 @@
From eb699a9c8fb7ddfcafc714f1eba1bbc395dc3675 Mon Sep 17 00:00:00 2001
From: Hauke D <haukex@zero-g.net>
Date: Wed, 12 Dec 2018 22:26:26 +0100
Subject: [PATCH] First "eof" should return true
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When no file has previously been opened, "eof" should return true. This
behavior was broken by 32e653230c7ccc (see also [#60978]).
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
pp_sys.c | 2 +-
t/io/tell.t | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/pp_sys.c b/pp_sys.c
index 5dc20b14f0..e28e8906f1 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2121,7 +2121,7 @@ PP(pp_eof)
}
if (!gv)
- RETPUSHNO;
+ RETPUSHYES;
if ((io = GvIO(gv)) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) {
return tied_method1(SV_CONST(EOF), SP, MUTABLE_SV(io), mg, newSVuv(which));
diff --git a/t/io/tell.t b/t/io/tell.t
index 30adafbc01..ba106f0cc7 100644
--- a/t/io/tell.t
+++ b/t/io/tell.t
@@ -189,7 +189,6 @@ seek *$fh,0,0;
is(tell, 0, "argless tell after seek *\$coercible...");
{
- local $TODO = "not fixed yet";
# [perl #133721]
fresh_perl_is(<<'EOI', 'ok', {}, 'eof with no ${^LAST_FH}');
print "ok" if eof;
--
2.17.2

View File

@ -0,0 +1,41 @@
From b4e880f3b5c8c8ba39c7c767167801a7caf81821 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 2 Jan 2019 11:49:47 +1100
Subject: [PATCH] [perl #133721] TODO test for eof with no ${^LAST_FH}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
t/io/tell.t | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/t/io/tell.t b/t/io/tell.t
index 7a046ca6b3..30adafbc01 100644
--- a/t/io/tell.t
+++ b/t/io/tell.t
@@ -6,7 +6,7 @@ BEGIN {
set_up_inc('../lib');
}
-plan(35);
+plan(36);
$TST = 'TST';
@@ -187,3 +187,11 @@ seek $fh,0,0;
is(tell, 0, "argless tell after seek \$coercible...");
seek *$fh,0,0;
is(tell, 0, "argless tell after seek *\$coercible...");
+
+{
+ local $TODO = "not fixed yet";
+ # [perl #133721]
+ fresh_perl_is(<<'EOI', 'ok', {}, 'eof with no ${^LAST_FH}');
+print "ok" if eof;
+EOI
+}
--
2.17.2

View File

@ -228,6 +228,10 @@ Patch43: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec-2.p
# in upstream after 5.29.6
Patch44: perl-5.28.1-perl-133524-report-line-number-for-Prototype-not-ter.patch
# Fix first eof() return value, RT#133721, in upstream after 5.29.6
Patch45: perl-5.29.6-perl-133721-TODO-test-for-eof-with-no-LAST_FH.patch
Patch46: perl-5.29.6-First-eof-should-return-true.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2826,6 +2830,8 @@ Perl extension for Version Objects
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch200 -p1
%patch201 -p1
@ -2865,6 +2871,7 @@ perl -x patchlevel.h \
'Fedora Patch39: Adjust tests to gdbm-1.15 (RT#133295)' \
'Fedora Patch42: Do not close an IPC pipe that already has a desired descriptor (RT#133726)' \
'Fedora Patch44: Fix reporting a line number for non-terminated prototypes (RT#133524)' \
'Fedora Patch45: Fix first eof() return value (RT#133721)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -5157,6 +5164,7 @@ popd
- Adjust tests to gdbm-1.15 using an upstream fix (RT#133295)
- Do not close an IPC pipe that already has a desired descriptor (RT#133726)
- Fix reporting a line number for non-terminated prototypes (RT#133524)
- Fix first eof() return value (RT#133721)
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-429
- Rebuilt for libcrypt.so.2 (#1666033)