From Meyser@xenet.de  Wed Mar  1 14:24:16 2006
Return-Path: <Meyser@xenet.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 05F7916A420
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  1 Mar 2006 14:24:16 +0000 (GMT)
	(envelope-from Meyser@xenet.de)
Received: from server1.xenet.de (server1.xenet.de [193.159.181.120])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 316DF43D46
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  1 Mar 2006 14:24:14 +0000 (GMT)
	(envelope-from Meyser@xenet.de)
Received: from intserv0.intern (xenet-gate.xenet.de [213.221.94.50])
	by server1.xenet.de (8.12.5/8.12.5) with ESMTP id k21EO3Qj032951
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 1 Mar 2006 15:24:04 +0100 (CET)
	(envelope-from matthias@server1.xenet.de)
Received: from intserv0.intern (localhost [127.0.0.1])
	by intserv0.intern (8.13.4/8.13.4) with ESMTP id k21EO3Lr004186
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 1 Mar 2006 15:24:03 +0100 (CET)
	(envelope-from matthias@intserv0.intern)
Received: (from matthias@localhost)
	by intserv0.intern (8.13.4/8.13.4/Submit) id k21EO3kB004185;
	Wed, 1 Mar 2006 15:24:03 +0100 (CET)
	(envelope-from matthias)
Message-Id: <200603011424.k21EO3kB004185@intserv0.intern>
Date: Wed, 1 Mar 2006 15:24:03 +0100 (CET)
From: Matthias Meyser <Meyser@xenet.de>
Reply-To: Matthias Meyser <Meyser@xenet.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ePerl coredumps as CGI Handler when used with Perl 5.8
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         93981
>Category:       ports
>Synopsis:       ePerl coredumps as CGI Handler when used with Perl 5.8
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 01 14:30:05 GMT 2006
>Closed-Date:    Mon Mar 06 11:16:11 CET 2006
>Last-Modified:  Mon Mar 06 11:16:11 CET 2006
>Originator:     Matthias Meyser
>Release:        FreeBSD 6.1-BETA1 i386
>Organization:
XeNET GmbH, Clausthal
>Environment:
System: FreeBSD intserv0.intern 6.1-BETA1 FreeBSD 6.1-BETA1 #2: Wed Mar 01 14:48:49 UTC 2006 root@intserv0.intern:/usr/obj/usr/src/sys/INTSERV0 i386


>Description:
	When compiled with Perl Version 5.8.8 eperl coredumps when used as a CGI handler.

>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

>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
	
--- patch-ad begins here ---
--- eperl_perl5.h.orig  Fri Jul 10 07:52:13 1998
+++ eperl_perl5.h       Wed Mar  1 12:12:32 2006
@@ -43,10 +43,10 @@


 /*  try to adjust for PerlIO handling  */
-#ifdef USE_PERLIO
-#undef  fwrite
-#define fwrite(buf,size,count,f) PerlIO_write(f,buf,size*count)
-#endif
+/* #ifdef USE_PERLIO */
+/* #undef  fwrite */
+/* #define fwrite(buf,size,count,f) PerlIO_write(f,buf,size*count) */
+/* #endif */


 /*  define the I/O type string for verbosity */
--- patch-ad ends here ---


>Release-Note:
>Audit-Trail:

From: Anton Berezin <tobez@tobez.org>
To: Matthias Meyser <Meyser@xenet.de>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/93981: ePerl coredumps as CGI Handler when used with Perl 5.8
Date: Wed, 1 Mar 2006 17:05:33 +0100

 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

From: Matthias Meyser <Meyser@xenet.de>
To: Anton Berezin <tobez@tobez.org>, Matthias Meyser <Meyser@xenet.de>,
   FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/93981: ePerl coredumps as CGI Handler when used with Perl 5.8
Date: Wed, 1 Mar 2006 17:29:09 +0100

 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
State-Changed-From-To: open->closed 
State-Changed-By: tobez 
State-Changed-When: Mon Mar 6 11:16:09 CET 2006 
State-Changed-Why:  
The fix has been committed. Thank you for your submission. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93981 
>Unformatted:
