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

Heesob Park phasis at gmail.com
Tue Nov 5 08:09:43 UTC 2013


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.

> 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.

> 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.

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

C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\win32-file-stat-1.3.6\test>irb
DL is deprecated, please use Fiddle
irb(main):001:0> File.stat('C:/')
=> #<File::Stat dev=0x2, ino=0, mode=040755, nlink=1, uid=0, gid=0, rdev=0x2, si
ze=0, blksize=nil, blocks=nil, atime=2013-10-29 19:15:16 +0900, mtime=2013-10-29
 19:15:16 +0900, ctime=2009-07-14 11:38:56 +0900>
irb(main):002:0> require 'win32/file/stat'
=> true
irb(main):003:0> File.stat('C:/')
TypeError: no implicit conversion of nil into String
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/win32-file-stat-1.3.6/lib/w
in32/file/stat.rb:212:in `expand_path'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/win32-file-stat-1.3.6/lib/w
in32/file/stat.rb:212:in `dev'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/win32-file-stat-1.3.6/lib/w
in32/file/stat.rb:410:in `block in inspect'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/win32-file-stat-1.3.6/lib/w
in32/file/stat.rb:404:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/win32-file-stat-1.3.6/lib/w
in32/file/stat.rb:404:in `inspect'
        from C:/Ruby200-x64/bin/irb:12:in `<main>'
irb(main):004:0>

Regards,
Park Heesob


More information about the win32utils-devel mailing list