On Thu, 18 Jan 2001, Paul Walmsley wrote:

> 
> (In the post below, 'STDIN', 'STDOUT', and 'STDERR' refer to Perl
> filehandles, while 'stdin', 'stdout', and 'stderr' refer to Perl file
> descriptors.)
> 
> During migration of a web application server from Perl 5.00503 to Perl
> 5.6, we discovered a bug in mod_perl 1.23 and above.  Under Perl 5.6,
> mod_perl ties both the STDIN and STDOUT filehandles to its Apache object,
> which now implements the &OPEN and &FILENO methods.  However, mod_perl
> erroneously hardcodes the POSIX file descriptor stdout into both methods.
> 
> This means that &open() and &fileno() calls on STDIN will operate on the
> stdout fd, rather than the stdin fd.  This is clearly broken.  This
> behavior can be easily verified with this test:
> 
>     die 'Bug!' if fileno (STDIN) == fileno (STDOUT);

the client in/out fd is the same under apache, FILENO should
probably be more like the patch below.
sounds like you might need to untie STDIN/STDOUT as you suggest.
maybe we can come up with something more clever after 1.25.

Index: src/modules/perl/Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.119
diff -u -r1.119 Apache.xs
--- src/modules/perl/Apache.xs  2000/12/29 17:10:08     1.119
+++ src/modules/perl/Apache.xs  2001/01/26 06:19:30
@@ -603,7 +603,7 @@
     Apache r
 
     CODE:
-    RETVAL = fileno(stdout);
+    RETVAL = r->connection->client->fd;
 
     OUTPUT:
     RETVAL


Reply via email to