Skip Menu |
 

This queue is for tickets about the Filter CPAN distribution.

Report information
The Basics
Id: 56875
Status: resolved
Priority: 0/
Queue: Filter

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Filter::exec segv on __DATA__
Date: Sat, 24 Apr 2010 11:16:59 +1000
To: bug-Filter [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 392b
With recent debian i386 packaged perl 5.10.1 the program foo.pl below gets a segv. gdb and libc claim it's a bad pointer to a free() in an sv_clear() somewhere under Perl_parser_free(). I'm not sure the __DATA__ token quite works with the way Filter::exec connects the input up to the subprocess, but I hoped it wouldn't segfault, especially when the DATA file handle as such is not used.
Download foo.pl
text/x-perl 33b
use Filter::exec 'cat'; __DATA__
Subject: [PATCH] Filter::exec segv on __DATA__
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 272b
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
Subject: 0001-Fix-tee-and-all-tests-to-work-with-Perl-5.14-and-hig.patch
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
Subject: 0002-bump-version-to-1.40.patch
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
Download (untitled) / with headers
text/plain 475b
On Thu Feb 09 23:57:03 2012, RURBAN wrote: Show quoted text
> 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.
Good stuff. Can I sugest adding a test to the test harness to check the patch works? Show quoted text
> Patches attached. > May I have have co-maint?
Certainly. Not sure how you get given it, but I have no objections. Paul
CC: <perl5-porters [...] perl.org>
Subject: RE: [rt.cpan.org #56875] [PATCH] Filter::exec segv on __DATA__
Date: Wed, 15 Feb 2012 21:36:42 -0000
To: <bug-Filter [...] rt.cpan.org>
From: "Paul Marquess" <Paul.Marquess [...] ntlworld.com>
Download (untitled) / with headers
text/plain 689b
I don't have any problems with giving Reni co-maint on the Filter distribution. Who is the keeper of the keys that can make this happen? Paul Show quoted text
-----Original Message----- From: Reini Urban via RT [mailto:bug-Filter@rt.cpan.org] Sent: 10 February 2012 04:57 Cc: perl5-porters@perl.org Subject: [rt.cpan.org #56875] [PATCH] Filter::exec segv on __DATA__ <URL: https://rt.cpan.org/Ticket/Display.html?id=56875 > 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
RT-Send-CC: Paul.Marquess [...] ntlworld.com, perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 897b
On Wed Feb 15 16:38:34 2012, Paul.Marquess@ntlworld.com wrote: Show quoted text
> I don't have any problems with giving Reni co-maint on the Filter > distribution. > > Who is the keeper of the keys that can make this happen? > > Paul
You are. Go to <https://pause.perl.org/pause/authenquery?ACTION=share_perms>. Look at section 3 on that page. Show quoted text
> > -----Original Message----- > From: Reini Urban via RT [mailto:bug-Filter@rt.cpan.org] > Sent: 10 February 2012 04:57 > Cc: perl5-porters@perl.org > Subject: [rt.cpan.org #56875] [PATCH] Filter::exec segv on __DATA__ > > <URL: https://rt.cpan.org/Ticket/Display.html?id=56875 > > > 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?
CC: <perl5-porters [...] perl.org>
Subject: RE: [rt.cpan.org #56875] Filter::exec segv on __DATA__
Date: Wed, 15 Feb 2012 22:27:26 -0000
To: <bug-Filter [...] rt.cpan.org>
From: "Paul Marquess" <Paul.Marquess [...] ntlworld.com>
Download (untitled) / with headers
text/plain 1.1k
Thanks Show quoted text
-----Original Message----- From: Father Chrysostomos via RT [mailto:bug-Filter@rt.cpan.org] Sent: 15 February 2012 22:14 Cc: Paul.Marquess@ntlworld.com; perl5-porters@perl.org Subject: [rt.cpan.org #56875] Filter::exec segv on __DATA__ <URL: https://rt.cpan.org/Ticket/Display.html?id=56875 > On Wed Feb 15 16:38:34 2012, Paul.Marquess@ntlworld.com wrote:
> I don't have any problems with giving Reni co-maint on the Filter > distribution. > > Who is the keeper of the keys that can make this happen? > > Paul
You are. Go to <https://pause.perl.org/pause/authenquery?ACTION=share_perms>. Look at section 3 on that page.
> > -----Original Message----- > From: Reini Urban via RT [mailto:bug-Filter@rt.cpan.org] > Sent: 10 February 2012 04:57 > Cc: perl5-porters@perl.org > Subject: [rt.cpan.org #56875] [PATCH] Filter::exec segv on __DATA__ > > <URL: https://rt.cpan.org/Ticket/Display.html?id=56875 > > > 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?
RT-Send-CC: Paul.Marquess [...] ntlworld.com
Fixed with 1.40, which I just uploaded. Thanks for the report. -- Reini Urban


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.