Skip Menu |

This queue is for tickets about the Apache-Session CPAN distribution.

Report information
The Basics
Id: 14759
Status: new
Priority: 0/
Queue: Apache-Session

People
Owner: Nobody in particular
Requestors: ralf.hack [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.6
Fixed in: (no value)



Subject: Apache::Session::File - incompatible to FastCGI
Using Apache::Session::File with perl 5.8.4 and FastCGI uncovered a bug in the filehandling of open files. The author appears to have mixed incompatible sysopen / seek. Hence the filehandle reused does appear to point to an empty file since it is frozen at the end. As a workaround, I replaced all sysopens with open and also closed the file immediately after usage. The latter may have been overkill but I was under pressure to fix it. Attached is the patch that made it to work. Time did no permit me to remove any unnecessary changes.
41,42c42,45 < sysopen ($self->{fh}, $directory.'/'.$session->{data}->{_session_id}, O_RDWR|O_CREAT) || < die "Could not open file ".$directory.'/'.$session->{data}->{_session_id}.": $!"; --- > my $fh; > open ($fh, "+<".$directory.'/'.$session->{data}->{_session_id}) || > die "Could not open file ".$directory.'/'. > $session->{data}->{_session_id}.": $!"; 45a49 > $self->{fh} = $fh; 46a51 > $self->close(); 55,56c61,63 < if (!$self->{opened}) { < sysopen ($self->{fh}, $directory.'/'.$session->{data}->{_session_id}, O_RDWR|O_CREAT) || --- > if (!$self->{opened} || 1) { > my $fh; > open ($fh, "+<".$directory.'/'.$session->{data}->{_session_id}) || 58a66 > $self->{fh}=$fh; 64a73 > $self->close(); 74,77c84,87 < if (!$self->{opened}) { < sysopen ($self->{fh}, $directory.'/'.$session->{data}->{_session_id}, O_RDWR|O_CREAT) || < die "Could not open file: $!"; < --- > my $fh; > if (!$self->{opened} || 1) { > open ($fh, "+<".$directory.'/'.$session->{data}->{_session_id}) > || die "Could not open file: $!"; 78a89 > $self->{fh} = $fh; 82c93 < } --- > }; 84,87c95,97 < my $fh = $self->{fh}; < while (<$fh>) { < $session->{serialized} .= $_; < } --- > local $\=undef; > $session->{serialized} .= join("",<$fh>); > $self->{fh} = $fh ; 92c102,103 < } --- > $self->close(); > }