FILENO IO:: interface patch to the FCGI CPAN module. (Was: Re: The FCGI module)

Tomas Doran <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
On 29 Nov 2009, at 20:38, Sven Verdoolaege wrote:

> On Sun, Nov 29, 2009 at 04:50:49PM +0000, Tomas Doran wrote:
>> Sven Verdoolaege wrote:
>>> Also, would you like me to collect your patches or do you
>>> plan on taking over eventually?
>
> Let's just stick to you sending me patches for now (CC'd to the list).
> I'll release a new version of FCGI before the end of the year.

Please find attached a patch to add a FILENO method to FCGI.pm, as  
discussed.

If you would prefer to view a diff in your browser, please see:
http://goatse.co.uk/~bobtfish/Gitalist/script/gitalist.fcgi/commitdiff?p=fcgi2.git;h=bc584fde07f64d87f33ec75b92bf342c3649c094

or if you'd like to pull from my repository:
http://goatse.co.uk/~bobtfish/fcgi2.git/

This fixes a longstanding issue (http://rt.cpan.org/Public/Bug/Display.html?id=50972 
), and removes the need for vendor patches applied by (at least)  
debian and OpenBSD.

Cheers
t0m




P.S. I am unsure if this message will make it to the FCGI developers  
list - I tried to subscribe from both my work and home addresses, but  
I only got a confirm to work (this address), and I am unable to log  
into the mailman web interface with the password in my 'welcome to the  
"FCGI-developers" mailing list email to check as it says the password  
is incorrect. The 'email me my password' button also does not appear  
to function as expected.

P.P.S. I emailed both addresses I could find for the list admin about  
this issue several days ago and have received no response.

_______________________________________________
FastCGI-developers mailing list
FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
0001-Add-FILENO-method-to-FCGI.pm-to-comply-with-IO-inter.patch (application/octet-stream, 2.1 KB)
From bc584fde07f64d87f33ec75b92bf342c3649c094 Mon Sep 17 00:00:00 2001
From: t0m <[email protected]>
Date: Sun, 29 Nov 2009 11:46:21 +0000
Subject: [PATCH] Add FILENO method to FCGI.pm to comply with IO:: interface

FILENO method returns a defined but invalid value (can never be defined
as the error return from the syscall is -1) to placate things such as
IPC::Run which call fileno to check if a filehandle is open.

Closes bugs:
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544540
 http://rt.cpan.org/Public/Bug/Display.html?id=50972
 Removes need for upstream patch in OpenBSD
---
 perl/ChangeLog |    8 ++++++++
 perl/FCGI.PL   |    9 +++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/perl/ChangeLog b/perl/ChangeLog
index 8c5547f..74e5b2e 100644
--- a/perl/ChangeLog
+++ b/perl/ChangeLog
@@ -1,3 +1,11 @@
+    o Add FILENO method which returns a defined but invalid value to
+      placate things such as IPC::Run which call fileno to check if a
+      filehandle is open.
+      Closes bugs:
+      http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544540
+      http://rt.cpan.org/Public/Bug/Display.html?id=50972
+      Removes need for upstream patch in OpenBSD
+
 Version 0.68 --	21 June 2003   <[email protected]> Sven Verdoolaege
 
 	o Call the fcgi lib's attach/detach <[email protected]>
diff --git a/perl/FCGI.PL b/perl/FCGI.PL
index f4069fd..0e6ebf0 100644
--- a/perl/FCGI.PL
+++ b/perl/FCGI.PL
@@ -390,10 +390,11 @@ sub OPEN {
     }
 }
 
-# Apparently some use fileno to determine if a filehandle is open,
-# so we might want to return a defined, but meaningless value.
-# An alternative would be to return the fcgi stream fd.
-# sub FILENO { -2 }
+# Some things (e.g. IPC::Run) use fileno to determine if a filehandle is open,
+# so we return a defined, but meaningless value. (-1 being the error return
+# value from the syscall in c, meaning it can never be a valid fd no)
+# Probably a better alternative would be to return the fcgi stream fd.
+sub FILENO { -1 }
 
 1;
 
-- 
1.6.5.3.171.ge36e
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.