I would detect the platform, avoid using File.stat.dev and do a copy/delete
instead of the move.

If you want to work on a patch for this, I'll be happy to apply it.

alex


On Fri, Dec 11, 2009 at 1:23 PM, Antoine Toulme <[email protected]>wrote:

> Hi guys,
>
> we have trouble here with one computer running Windows 7 64 bit.
>
> Buildr installs fine on top of JRuby but it crashes with this message:
> stat.st_dev unsupported on this platform
>
> That sounded like a JRuby problem, so I asked the IRC channel there. I was
> told this would not be working on 64 bit archs.
>
> This problem arises when moving files, here, with that monkey patching:
> # Fix for BUILDR-292.
>  # JRuby fails to rename a file on different devices
>  # this monkey-patch wont be needed when JRUBY-3381 gets resolved.
>  module FileUtils #:nodoc:
>    alias_method :__mv_native, :mv
>
>    def mv(from, to, options = nil)
>      dir_to = File.directory?(to) ? to : File.dirname(to)
>      Array(from).each do |from|
>        dir_from = File.dirname(from)
>        if File.stat(dir_from).dev != File.stat(dir_to).dev
>          cp from, to, options
>          rm from, options
>        else
>          __mv_native from, to, options
>        end
>      end
>    end
>    private :mv
>  end
>
> I see http://jira.codehaus.org/browse/JRUBY-3381 is still opened. I don't
> understand the last comment by Charles Oliver Nutter.
>
> What would be the right approach now ? Ask for a 64 bit distrib of JRuby ?
> Try to catch the error and work around it ?
>
> I suggested the user tried Cygwin for now but I would feel better with
> something less clunky.
> Any help is much welcome.
>
> Thanks,
>
> Antoine
>

Reply via email to