fix #221113, $! wrongly set when EOF is reached
This commit is contained in:
parent
e85f81aec1
commit
3b1adc4110
83
perl-perlio-incorrect-errno.patch
Normal file
83
perl-perlio-incorrect-errno.patch
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
From e57cc2468d765872b20810478b94ead3906f1912 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Stepan Kasal <skasal@redhat.com>
|
||||||
|
Date: Wed, 3 Jun 2009 12:03:55 +0200
|
||||||
|
Subject: [PATCH] fix RT 39060, errno incorrectly set in perlio
|
||||||
|
|
||||||
|
---
|
||||||
|
MANIFEST | 1 +
|
||||||
|
perlio.c | 12 +++++++-----
|
||||||
|
t/io/errno.t | 26 ++++++++++++++++++++++++++
|
||||||
|
3 files changed, 34 insertions(+), 5 deletions(-)
|
||||||
|
create mode 100644 t/io/errno.t
|
||||||
|
|
||||||
|
diff --git a/MANIFEST b/MANIFEST
|
||||||
|
index b7c9341..be3be43 100644
|
||||||
|
--- a/MANIFEST
|
||||||
|
+++ b/MANIFEST
|
||||||
|
@@ -3899,6 +3899,7 @@ t/io/binmode.t See if binmode() works
|
||||||
|
t/io/crlf.t See if :crlf works
|
||||||
|
t/io/crlf_through.t See if pipe passes data intact with :crlf
|
||||||
|
t/io/dup.t See if >& works right
|
||||||
|
+t/io/errno.t See if $! is correctly set
|
||||||
|
t/io/fflush.t See if auto-flush on fork/exec/system/qx works
|
||||||
|
t/io/fs.t See if directory manipulations work
|
||||||
|
t/io/inplace.t See if inplace editing works
|
||||||
|
diff --git a/perlio.c b/perlio.c
|
||||||
|
index 0a086a8..e92a32a 100644
|
||||||
|
--- a/perlio.c
|
||||||
|
+++ b/perlio.c
|
||||||
|
@@ -1784,12 +1784,14 @@ PerlIO_has_base(PerlIO *f)
|
||||||
|
int
|
||||||
|
PerlIO_fast_gets(PerlIO *f)
|
||||||
|
{
|
||||||
|
- if (PerlIOValid(f) && (PerlIOBase(f)->flags & PERLIO_F_FASTGETS)) {
|
||||||
|
- const PerlIO_funcs * const tab = PerlIOBase(f)->tab;
|
||||||
|
+ if (PerlIOValid(f)) {
|
||||||
|
+ if (PerlIOBase(f)->flags & PERLIO_F_FASTGETS) {
|
||||||
|
+ const PerlIO_funcs * const tab = PerlIOBase(f)->tab;
|
||||||
|
|
||||||
|
- if (tab)
|
||||||
|
- return (tab->Set_ptrcnt != NULL);
|
||||||
|
- SETERRNO(EINVAL, LIB_INVARG);
|
||||||
|
+ if (tab)
|
||||||
|
+ return (tab->Set_ptrcnt != NULL);
|
||||||
|
+ SETERRNO(EINVAL, LIB_INVARG);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SETERRNO(EBADF, SS_IVCHAN);
|
||||||
|
diff --git a/t/io/errno.t b/t/io/errno.t
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..b55e3db
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/t/io/errno.t
|
||||||
|
@@ -0,0 +1,26 @@
|
||||||
|
+#!./perl
|
||||||
|
+# vim: ts=4 sts=4 sw=4:
|
||||||
|
+
|
||||||
|
+# $! may not be set if EOF was reached without any error.
|
||||||
|
+# http://rt.perl.org/rt3/Ticket/Display.html?id=39060
|
||||||
|
+
|
||||||
|
+use strict;
|
||||||
|
+require './test.pl';
|
||||||
|
+
|
||||||
|
+plan( tests => 16 );
|
||||||
|
+
|
||||||
|
+my $test_prog = 'while(<>){print}; print $!';
|
||||||
|
+
|
||||||
|
+for my $perlio ('perlio', 'stdio') {
|
||||||
|
+ $ENV{PERLIO} = $perlio;
|
||||||
|
+ for my $test_in ("test\n", "test") {
|
||||||
|
+ my $test_in_esc = $test_in;
|
||||||
|
+ $test_in_esc =~ s/\n/\\n/g;
|
||||||
|
+ for my $rs_code ('', '$/=undef', '$/=\2', '$/=\1024') {
|
||||||
|
+ is( runperl( prog => "$rs_code; $test_prog",
|
||||||
|
+ stdin => $test_in, stderr => 1),
|
||||||
|
+ $test_in,
|
||||||
|
+ "Wrong errno, PERLIO=$ENV{PERLIO} stdin='$test_in_esc'");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
1.6.2
|
||||||
|
|
15
perl.spec
15
perl.spec
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
Name: perl
|
Name: perl
|
||||||
Version: %{perl_version}
|
Version: %{perl_version}
|
||||||
Release: 68%{?dist}
|
Release: 69%{?dist}
|
||||||
Epoch: %{perl_epoch}
|
Epoch: %{perl_epoch}
|
||||||
Summary: Practical Extraction and Report Language
|
Summary: Practical Extraction and Report Language
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
@ -179,6 +179,9 @@ Patch56: 37_fix_coredump_indicator
|
|||||||
# Upstream change 34209
|
# Upstream change 34209
|
||||||
Patch57: 38_fix_weaken_memleak
|
Patch57: 38_fix_weaken_memleak
|
||||||
|
|
||||||
|
# http://rt.perl.org/rt3/Ticket/Display.html?id=39060 (#221113)
|
||||||
|
Patch58: perl-perlio-incorrect-errno.patch
|
||||||
|
|
||||||
### End of Debian Patches ###
|
### End of Debian Patches ###
|
||||||
|
|
||||||
# Update some of the bundled modules
|
# Update some of the bundled modules
|
||||||
@ -978,6 +981,7 @@ upstream tarball from perl.org.
|
|||||||
%patch55 -p1
|
%patch55 -p1
|
||||||
%patch56 -p1
|
%patch56 -p1
|
||||||
%patch57 -p1
|
%patch57 -p1
|
||||||
|
%patch58 -p1
|
||||||
|
|
||||||
%patch100 -p1
|
%patch100 -p1
|
||||||
%patch101 -p1
|
%patch101 -p1
|
||||||
@ -1243,6 +1247,7 @@ perl -x patchlevel.h \
|
|||||||
'Fedora Patch55: File::Path::rmtree no longer allows creating of setuid files.' \
|
'Fedora Patch55: File::Path::rmtree no longer allows creating of setuid files.' \
|
||||||
'Fedora Patch56: Fix $? when dumping core' \
|
'Fedora Patch56: Fix $? when dumping core' \
|
||||||
'34209 Fix a memory leak with Scalar::Util::weaken()' \
|
'34209 Fix a memory leak with Scalar::Util::weaken()' \
|
||||||
|
'fix RT 39060, errno incorrectly set in perlio' \
|
||||||
'Fedora Patch100: Update module constant to %{constant_version}' \
|
'Fedora Patch100: Update module constant to %{constant_version}' \
|
||||||
'Fedora Patch101: Update Archive::Extract to %{Archive_Extract_version}' \
|
'Fedora Patch101: Update Archive::Extract to %{Archive_Extract_version}' \
|
||||||
'Fedora Patch102: Update Archive::Tar to %{Archive_Tar_version}' \
|
'Fedora Patch102: Update Archive::Tar to %{Archive_Tar_version}' \
|
||||||
@ -1272,7 +1277,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
%check
|
%check
|
||||||
%ifnarch sparc64
|
%ifnarch sparc64
|
||||||
# work around a bug in Module::Build tests bu setting TMPDIR to a directory
|
# work around a bug in Module::Build tests by setting TMPDIR to a directory
|
||||||
# inside the source tree
|
# inside the source tree
|
||||||
mkdir "$PWD/tmp"
|
mkdir "$PWD/tmp"
|
||||||
TMPDIR="$PWD/tmp" make test
|
TMPDIR="$PWD/tmp" make test
|
||||||
@ -1887,9 +1892,11 @@ TMPDIR="$PWD/tmp" make test
|
|||||||
|
|
||||||
# Old changelog entries are preserved in CVS.
|
# Old changelog entries are preserved in CVS.
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 3 2009 Stepan Kasal <skasal@redhat.com> - 4:5.10.0-69
|
||||||
|
- fix #221113, $! wrongly set when EOF is reached
|
||||||
|
|
||||||
* Fri Apr 10 2009 Marcela Mašláňová <mmaslano@redhat.com> - 4:5.10.0-68
|
* Fri Apr 10 2009 Marcela Mašláňová <mmaslano@redhat.com> - 4:5.10.0-68
|
||||||
- 495183 don't use special characters in spec according to patchlevel.h.
|
- do not use quotes in patchlevel.h; it breaks installation from cpan (#495183)
|
||||||
It breaks installation from cpan.
|
|
||||||
|
|
||||||
* Tue Apr 7 2009 Stepan Kasal <skasal@redhat.com> - 4:5.10.0-67
|
* Tue Apr 7 2009 Stepan Kasal <skasal@redhat.com> - 4:5.10.0-67
|
||||||
- update CGI to 3.43, dropping upstreamed perl-CGI-escape.patch
|
- update CGI to 3.43, dropping upstreamed perl-CGI-escape.patch
|
||||||
|
Loading…
Reference in New Issue
Block a user