=begin
The openssl extension uses the BIO_new_fp openssl api, which takes a stream. This causes segmentation faults on windows if openssl and the openssl ruby extension are using different runtime c libraries since you can't pass streams between libraries.
I'm curious why you rejected this patch. Is there any real difference between Ruby opening the file or openssl opening the file?
The reason I think it is important is that it causes a segmentation fault if you mix runtime libraries on Windows. Say a Windows developer downloads Openssl binaries from here (this is the recommended link from the openssl home page):
Those are built with VC2008 it seems. So if you have a MingW built version of Ruby then this call will result in a segmentation fault. Using the file api, as the patch does, fixes the problem.
Would you accept a patch if it does an #ifdef just for Windows?
At Fri, 13 Mar 2009 17:00:22 +0900,
Charlie Savage wrote in [ruby-core:22868]:
I'm curious why you rejected this patch. Is there any real
difference between Ruby opening the file or openssl opening
the file?
IO isn't always associated with a file, and the file may has
been renamed or unlinked.
The reason I think it is important is that it causes a
segmentation fault if you mix runtime libraries on Windows.
Say a Windows developer downloads Openssl binaries from here
(this is the recommended link from the openssl home page):
IO isn't always associated with a file, and the file may has
been renamed or unlinked.
Ah, that's a good point. Maybe ruby could convert the io stream to a string and pass that to openssl (at least on Windows)?
Note that I have built ruby with msvcr90d.ll, but all the extension libraries (iconv, openssl, etc.) are built with msvc90.dll. I've run into two issues - the memory issue (fixed) and this file issue.
What about errno?
Yes, I remember you mentioned this the other day. What is the issue? Do you have some example code I could look at by chance? I've never run into this problem with ruby (I have seen an issue once in the gdal code base).
Thanks for taking the time to go through all these issues.