develooper Front page | perl.perl5.porters | Postings from May 2003

[perl #19863] PerlIO flush issue

From:
Arthur Bergman
Date:
May 9, 2003 06:13
Subject:
[perl #19863] PerlIO flush issue
Message ID:
rt-19863-57053.1.37649681966806@bugs6.perl.org
This bug is essentially a dupe of http://mathforum.org/epigone/modperl/
zhoolamgheld/m3lm9ml44m.fsf@k242.linux.bogus which was reported by Andreas 
König Tue, 11 Jun 2002 and caused quite a lot of headache before the culprit was 
found.

The solution to the bug is to upgrade to libapreq 1.1 / Apache::Request 1.1 since 1.0 is 
the offending module. Sadly 1.1 was not released until february 2003 even if the patch 
was from the summer 2002. 1.1 incorprates the patch slightly differently and even more 
robust. The other solution is to make sure you don't have upload filehandles around 
when you do a system() call (or anything that flushes all filehandles).

What happens essentially is that Apache::Request gets a filehandle for the upload and 
tells perl about it, however it forgot to tell Perl it was a readonly filehandle. So when perl 
does a backtik or system operation it tries to flush all filehandles, this include trying to 
flush the readonly filehandle it thought was writeable. This lead to a segfault depending 
on what data was in there.

Apache::Request 1.1 fixes this by importing the filehandle as readonly.

Arthur



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About