Finally I fixed the remaining Filter bugs.
The problems were caused by using the SvIV for the generated SvIO filter stream object.
I replaced that to use the unused IoOFP field, which is only used for printing.
Patches attached.
May I have have co-maint?
--
Reini Urban
From b247d7fdded6a702f4fc9b7c1e6d40b76d517f0d Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpanel.net>
Date: Thu, 9 Feb 2012 22:50:26 -0600
Subject: [PATCH 1/2] Fix tee and all tests to work with Perl 5.14 and higher.
PVIO has no IV field anymore, so abuse now the empty IoOFP,
which is only used for printing, not reading.
Fixes [RT #56875] and more.
Tested for 5.6.2, 5.8.4, 5.8.5, 5.8.8, 5.8.9, 5.10.1, 5.12.4,
5.14.2, 5.15.7
---
Changes | 9 +++++++++
Makefile.PL | 2 +-
tee/tee.xs | 20 ++++++++++++++++----
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/Changes b/Changes
index a3ab719..73d6694 100644
--- a/Changes
+++ b/Changes
@@ -326,3 +326,12 @@
* Fix decrypt to work with Perl 5.14
[RT #67656]
+1.40 9 Feb 2012 rurban
+----
+
+ * Fix tee and all tests to work with Perl 5.14 and higher.
+ PVIO has no IV field anymore, so abuse the empty IoOFP,
+ which is only used for printing, not reading.
+ Fixes [RT #56875] and more.
+ Tested for 5.6.2, 5.8.4, 5.8.5, 5.8.8, 5.8.9, 5.10.1, 5.12.4,
+ 5.14.2, 5.15.7
diff --git a/Makefile.PL b/Makefile.PL
index 0fd41b5..517e203 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -50,7 +50,7 @@ else
WriteMakefile(
NAME => 'Filter',
- VERSION => '1.39',
+ VERSION => '1.40',
'linkext' => {LINKTYPE => ''},
'dist' => {COMPRESS=>'gzip', SUFFIX=>'gz',
DIST_DEFAULT => 'tardist'},
diff --git a/tee/tee.xs b/tee/tee.xs
index 0d1b347..3906b17 100644
--- a/tee/tee.xs
+++ b/tee/tee.xs
@@ -16,7 +16,11 @@ static I32
filter_tee(pTHX_ int idx, SV *buf_sv, int maxlen)
{
I32 len;
- PerlIO * fil = (PerlIO*) SvIV(FILTER_DATA(idx)) ;
+#if PERL_VERSION > 8 || (PERL_VERSION == 8 && PERL_SUBVERSION > 8)
+ PerlIO * fil = (PerlIO*) IoOFP(FILTER_DATA(idx));
+#else
+ PerlIO * fil = (PerlIO*) SvIV(FILTER_DATA(idx));
+#endif
int old_len = SvCUR(buf_sv) ;
if ( (len = FILTER_READ(idx+1, buf_sv, maxlen)) <=0 ) {
@@ -41,7 +45,11 @@ import(module, filename)
SV * module = NO_INIT
char * filename
CODE:
- SV * stream = newSViv(0) ;
+#if PERL_VERSION > 8 || (PERL_VERSION == 8 && PERL_SUBVERSION > 8)
+ SV * stream = newSV_type(SVt_PVIO);
+#else
+ SV * stream = newSViv(0);
+#endif
PerlIO * fil ;
char * mode = "wb" ;
@@ -58,6 +66,10 @@ import(module, filename)
croak("Filter::tee - cannot open file '%s': %s",
filename, Strerror(errno)) ;
- /* save the tee'd file handle */
- SvIV_set(stream, (IV)fil) ;
+ /* save the tee'd file handle. */
+#if PERL_VERSION > 8 || (PERL_VERSION == 8 && PERL_SUBVERSION > 8)
+ IoOFP(stream) = (PerlIO*) fil;
+#else
+ SvIV_set(stream, (PerlIO*) fil);
+#endif
--
1.7.7.4
From c1458d7e2e28c83485272fe8c90fc83de25406cb Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpanel.net>
Date: Thu, 9 Feb 2012 22:52:37 -0600
Subject: [PATCH 2/2] bump version to 1.40
---
Call/Call.pm | 2 +-
Call/Call.xs | 2 +-
Exec/Exec.pm | 2 +-
META.yml | 2 +-
decrypt/decrypt.pm | 2 +-
lib/Filter/cpp.pm | 2 +-
lib/Filter/exec.pm | 2 +-
lib/Filter/sh.pm | 2 +-
tee/tee.pm | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Call/Call.pm b/Call/Call.pm
index 7fe63fa..a502575 100644
--- a/Call/Call.pm
+++ b/Call/Call.pm
@@ -18,7 +18,7 @@ use vars qw($VERSION @ISA @EXPORT) ;
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw( filter_add filter_del filter_read filter_read_exact) ;
-$VERSION = "1.39" ;
+$VERSION = "1.40" ;
sub filter_read_exact($)
{
diff --git a/Call/Call.xs b/Call/Call.xs
index 2871190..69f677d 100644
--- a/Call/Call.xs
+++ b/Call/Call.xs
@@ -3,7 +3,7 @@
*
* Author : Paul Marquess
* Date : 24th April 2011
- * Version : 1.39
+ * Version : 1.40
*
* Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
* This program is free software; you can redistribute it and/or
diff --git a/Exec/Exec.pm b/Exec/Exec.pm
index 97a3700..fbeca72 100644
--- a/Exec/Exec.pm
+++ b/Exec/Exec.pm
@@ -6,7 +6,7 @@ use strict;
use warnings;
use vars qw(@ISA $VERSION) ;
@ISA = qw(DynaLoader);
-$VERSION = "1.39" ;
+$VERSION = "1.40" ;
bootstrap Filter::Util::Exec ;
1 ;
diff --git a/META.yml b/META.yml
index d002bc6..b398ceb 100644
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Filter
-version: 1.39
+version: 1.40
abstract: Source Filters
author:
- Paul Marquess <pmqs@cpan.org>
diff --git a/decrypt/decrypt.pm b/decrypt/decrypt.pm
index 827eb09..a1ec218 100644
--- a/decrypt/decrypt.pm
+++ b/decrypt/decrypt.pm
@@ -6,7 +6,7 @@ use strict;
use warnings;
use vars qw(@ISA $VERSION);
@ISA = qw(DynaLoader);
-$VERSION = "1.39" ;
+$VERSION = "1.40" ;
bootstrap Filter::decrypt ;
1;
diff --git a/lib/Filter/cpp.pm b/lib/Filter/cpp.pm
index ff08d43..6f42714 100644
--- a/lib/Filter/cpp.pm
+++ b/lib/Filter/cpp.pm
@@ -7,7 +7,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = '1.39' ;
+$VERSION = '1.40' ;
my $cpp;
my $sep;
diff --git a/lib/Filter/exec.pm b/lib/Filter/exec.pm
index 4920b9b..76308db 100644
--- a/lib/Filter/exec.pm
+++ b/lib/Filter/exec.pm
@@ -6,7 +6,7 @@ use strict ;
use warnings ;
use vars qw($VERSION) ;
-$VERSION = "1.39" ;
+$VERSION = "1.40" ;
sub import
{
diff --git a/lib/Filter/sh.pm b/lib/Filter/sh.pm
index c90a41a..314f6bf 100644
--- a/lib/Filter/sh.pm
+++ b/lib/Filter/sh.pm
@@ -4,7 +4,7 @@ use Carp ;
use strict ;
use warnings ;
use vars qw($VERSION) ;
-$VERSION = "1.39" ;
+$VERSION = "1.40" ;
use Filter::Util::Exec ;
diff --git a/tee/tee.pm b/tee/tee.pm
index ed610ef..a0d4cf3 100644
--- a/tee/tee.pm
+++ b/tee/tee.pm
@@ -6,7 +6,7 @@ use strict;
use warnings;
use vars qw( @ISA $VERSION);
@ISA = qw(DynaLoader);
-$VERSION = "1.39" ;
+$VERSION = "1.40" ;
bootstrap Filter::tee ;
--
1.7.7.4