[Win32utils-devel] [ win32utils-Bugs-14360 ] Bad interaction between win32-file-stat and FileUtils

Heesob Park phasis at gmail.com
Mon Oct 1 21:19:26 EDT 2007


Hi,

2007/10/2, noreply at rubyforge.org <noreply at rubyforge.org>:
>
> Bugs item #14360, was opened at 2007-10-01 15:00
> You can respond by visiting:
> http://rubyforge.org/tracker/?func=detail&atid=411&aid=14360&group_id=85
>
> Category: win32-file-stat
> Group: Code
> Status: Open
> Resolution: None
> Priority: 3
> Submitted By: Daniel Berger (djberg96)
> Assigned to: Nobody (None)
> Summary: Bad interaction between win32-file-stat and FileUtils
>
> Initial Comment:
> Ruby 1.8.6-25 (one-click)
> win32-file-stat 1.2.6
>
> I already dealt with the lstat issue for the 'find' module, but I'm not
> sure how to fix this one off the top of my head.
>
> # stat-mv.rb
> require 'win32/file'
> require 'win32/file/stat'
> require 'fileutils'
>
> Dir.mkdir('foo') unless File.exists?('foo')
> FileUtils.touch('temp.txt')
> FileUtils.mv('temp.txt', 'foo')
> # END CODE
>
> C:\>ruby stat-mv.rb
>
> C:/ruby/lib/ruby/gems/1.8/gems/win32-file-stat-1.2.6/lib/win32/file/stat.rb:575:in
> `get_file_type': The system cannot fi
> nd the file specified. (ArgumentError)
>        from C:/ruby/lib/ruby/gems/1.8/gems/win32-file-stat-1.2.6/lib/win32/file/stat.rb:53:in
> `initialize'
>        from C:/ruby/lib/ruby/gems/1.8/gems/win32-file-0.5.4/lib/win32/file.rb:532:in
> `new'
>        from C:/ruby/lib/ruby/gems/1.8/gems/win32-file-0.5.4/lib/win32/file.rb:532:in
> `stat'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:1200:in `lstat'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:1207:in `lstat!'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:1125:in `exist?'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:497:in `mv'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:1409:in `fu_each_src_dest0'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:1393:in `fu_each_src_dest'
>        from C:/ruby/lib/ruby/1.8/fileutils.rb:494:in `mv'
>        from stat-mv.rb:9
>
> Suggestions?
>
> Dan (me)


Modification of stat.rb at line #561
            raise ArgumentError, get_last_error(error_num)
to
            raise SystemCallError, get_last_error(error_num)
would be a workaround for this case.

Regards,

Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20071002/36da3a45/attachment.html 


More information about the win32utils-devel mailing list