Subject: | [PATCH] Another (hopefully last) bunch of Win32 compatibility issues |
Date: | Sun, 12 Jul 2009 12:03:07 +0200 |
To: | bug-RPC-XML [...] rt.cpan.org |
From: | kmx <kmx [...] volny.cz> |
Hi,
thank you very much for releasing v0.67 my previously reported bugs fixed.
I am very sorry for making another "Win32 troubles" but during detailed
testing on Win32 platform I have found another more or less serious
Win32 issues. I have prepared also a patch against v0.67 that fixes all
of them.
1) Writing binary data into a filehandle via print() does not work well
on Win32 (its well-known binary vs. ascii issue).
This happens (at least) in Client.pm (between lines 282-293) while using
compression of request data. I have fixed this by addinng
"binmode($req_fh)" after opening the handle $req_fh.
I am not sure if this is the only place in RPC::XML where this problems
can occur. More systematic solution would probably be using "syswrite"
instead of "print" but my patch using "binmode" was simpler and works.
2) Client timeout too long when server not running
On Win32/Strawberry perl 5.10.0 (not an issue on Win32/5.8.9) for some
reason the client timeout when the server is not running is very very
long (this happens during tests at the beginning of 50_client.t, first I
thought that tests hang up). I have solved this by adding
"$cli->timeout(5)" near the beginning of 50_client.t.
3) The trick with unlinking an open filehandle does not work on Win32
The result of this was that the temporary files created by RPC::XML
stayed in temporary dir (or in the ./t/ dir after tests finished). I
have decided to use slightly different approach based on File::Temp. To
implement approximately the same behaviour (automatic deletion of
temporary files) I patched RPC::XML to create temporary files via
File::Temp with UNLINK=>1. It seems to work well (more testing would be
fine).
4) Getting directory via "File::Spec->splitpath" was not Win32 aware
In nearly all test you use something like this to get full path to
directory:
(undef, $dir, undef) = File::Spec->splitpath(File::Spec->rel2abs($0));
It works nice on UNIX systems; however on Win32 $dir contains path like
this:
- "\dir1\dir2\dir3"
- the right value shoud be "d:\dir1\dir2\dir3"
Path format "\aa\bb\cc" is also accreted by Win32 but I have patched the
tests to return true full dir name on Win32 (it is compatible with UNIX)
- patch looks like this:
($vol, $dir, undef) = File::Spec->splitpath(File::Spec->rel2abs($0));
$dir = File::Spec->catpath($vol, $dir, '');
5) Dependency on Scalar::Util 1.20 makes trouble on Win32/Strawberry
5.10.0 (not an issue on Win32/5.8.9)
The problem is that Win32/Strawberry 5.10.0 comes with pre installed
Scalar::Util 1.19 and installation of the most recent version (1.21)
fails during tests. I know that it is not a problem of RPC::XML but
please consider if you can live with 1.19.
6) An issue in 40_server.t similar to RT 27778 revealed during test on
Win32/cygwin
Patched in the same way as MSWin32.
I have fixed all the above described issues and you can find them in the
attached .diff (it is a diff against official release 0.67). I have
tested the patched version with the following perls:
- Win32/Strawberry/5.8.9
- Win32/Strawberry/5.10.0
- Win32/Cygwin/5.10.0
- Linux/5.8.8
--
kmx
Message body not shown because it is not plain text.