[Win32utils-devel] win32-file-stat and ffi

Daniel Berger djberg96 at gmail.com
Tue Nov 5 14:26:45 UTC 2013


Hi,

On Tue, Nov 5, 2013 at 1:09 AM, Heesob Park <phasis at gmail.com> wrote:

> Hi,
>
> 2013/11/5 Daniel Berger <djberg96 at gmail.com>:
> > Hi all,
> >
> > I'm converting the win32-file-stat lib to FFI, but I'm hitting some
> issues.
> > I'm using the "ffi2" branch.
> >
> > First, the test suite segfaults as the result of any tests that are
> checking
> > against "NUL". This seems to be tied to the wide version of
> FindFirstFile in
> > the constructor, as the ansi version works fine. The weird thing is that
> I
> > can't duplicate the problem in standalone programs.
> >
> I fixed the segfaluts and committed.
>

Excellent, thank you!


> > Second, I can't seem to access something like a removable disk with
> > FindFirstFile. I get an ENOENT error when I try File::Stat.new("E:/"),
> for
> > example.
> >
> The FindFirstFile call fails with removable disk root path.
> I committed a workaround for removable disk root path.
>

Ah, thanks.


> > I'm also not totally sure the newer approach works with system files or
> > locked files.
> >
> Is there any case of failure? It works fine with my test.
>

File::Stat.new("C:/pagefile.sys")

In the original code you provided a patch to work around this using
QueryDosDevice, though I think it only worked for a 32-bit OS.


>
> BTW, Why File#stat fails after requiring win32-file-stat?
> Is this a intended behavior?
>

It's unavoidable because File and File::Stat are so intertwined in MRI. I
noted this in the README file. In real code you should never require
win32-file-stat. You should just require win32-file, which in turn will
require win32-file-stat.

That means I can't release this new version until I have also updated
win32-file. They basically have to be released together.

Regards,

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20131105/088b8fdc/attachment.html>


More information about the win32utils-devel mailing list