Bug 93981 - ePerl coredumps as CGI Handler when used with Perl 5.8
Summary: ePerl coredumps as CGI Handler when used with Perl 5.8
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-01 14:30 UTC by Meyser+bugs.freebsd.org
Modified: 2006-03-06 10:16 UTC (History)
0 users

See Also:


Attachments
patch-ad (453 bytes, text/plain)
2006-03-01 14:30 UTC, Meyser+bugs.freebsd.org
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Meyser+bugs.freebsd.org 2006-03-01 14:30:05 UTC
	When compiled with Perl Version 5.8.8 eperl coredumps when used as a CGI handler.

Fix: In "eperl_perl5.h" the function "fwrite" is redefined iby a macro to use "PerlIO_write".
	"FILE *" parameter (fwrite) ist used as "PerlIO *" parameter (PerlIO_write).
	This does not work. It may have worked with older Perl versions.

	Using the original fwrite works with Perl 5.8.8 (tested) and schould work with older
        Versions of Perl (not tested).

	patch follows
	
How-To-Repeat: 
	Build and Install Perl Version 5.8.8 from ports
	Build and install ePerl from ports
	
	do the following

	echo '<? print "hello"; !>' >test.epl 
	eperl -mc test.epl
Comment 1 Anton Berezin 2006-03-01 16:05:33 UTC
On Wed, Mar 01, 2006 at 03:24:03PM +0100, Matthias Meyser wrote:

> 	In "eperl_perl5.h" the function "fwrite" is redefined iby a macro to use "PerlIO_write".
> 	"FILE *" parameter (fwrite) ist used as "PerlIO *" parameter (PerlIO_write).
> 	This does not work. It may have worked with older Perl versions.
> 
> 	Using the original fwrite works with Perl 5.8.8 (tested) and schould work with older
>         Versions of Perl (not tested).

I am not sure that using the stdio's fwrite is safe, when the rest of
embedded perl (any perl code, basically) is using PerlIO.  There might
be some interesting effects with regard to buffering.

\Anton.
-- 
An undefined problem has an infinite number of solutions.
-- Robert A. Humphrey
Comment 2 Meyser+bugs.freebsd.org 2006-03-01 16:29:09 UTC
On Wed, Mar 01, 2006 at 05:05:33PM +0100, Anton Berezin wrote:
> On Wed, Mar 01, 2006 at 03:24:03PM +0100, Matthias Meyser wrote:
> 
> > 	In "eperl_perl5.h" the function "fwrite" is redefined iby a macro to use "PerlIO_write".
> > 	"FILE *" parameter (fwrite) ist used as "PerlIO *" parameter (PerlIO_write).
> > 	This does not work. It may have worked with older Perl versions.
> > 
> > 	Using the original fwrite works with Perl 5.8.8 (tested) and schould work with older
> >         Versions of Perl (not tested).
> 
> I am not sure that using the stdio's fwrite is safe, when the rest of
> embedded perl (any perl code, basically) is using PerlIO.  There might
> be some interesting effects with regard to buffering.

Thats right. But the whole thing uses stdio and only the fwrite function
ist redefined to use PerlIO. Using stdio handles in PerlIO is definitivly broken.

I agree that this fix may cause problems in other places. (threading)
But its less "worse" than the original code and makes eperl work again. :)

Best thing would be to rewrite the code to use PerlIO in all places.

CU
   matthias
-- 
Matthias Meyser          | XeNET Gesellschaft fuer Informations- und 
Telefon: +49-5323-94018  | Kommunikationssysteme mbH
Fax:     +49-5323-94014  | Burgstaetter Strasse 6
Email:   Meyser@xenet.de | 38678 Clausthal-Zellerfeld
Comment 3 Anton Berezin freebsd_committer freebsd_triage 2006-03-06 10:16:09 UTC
State Changed
From-To: open->closed

The fix has been committed. Thank you for your submission.