Issue #8109 has been reported by mitchellh (Mitchell Hashimoto). ---------------------------------------- Bug #8109: FileUtils.mv fails across devices on Windows https://bugs.ruby-lang.org/issues/8109 Author: mitchellh (Mitchell Hashimoto) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 2.0.0-p0 Reproduction code: https://gist.github.com/luislavena/5179408 The issue is that Ruby is using MoveFile under the covers: http://msdn.microsoft.com/en-us/library/windows/de... Quote directly from the MoveFile docs: "The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume." Instead, MoveFileEx should be used with the MOVEFILE_COPY_ALLOWED flag. This function has existed since XP, and since Ruby 1.9 is XP+, we can safely switch to this: http://msdn.microsoft.com/en-us/library/windows/de... The MoveFileEx call with the proper flag will just do the right thing.
on 2013-03-18 07:03
on 2013-03-18 08:16
Issue #8109 has been updated by nobu (Nobuyoshi Nakada). Why Windows returns ERROR_ACCESS_DENIED on cross-device link for directory, while ERROR_NOT_SAME_DEVICE for file? ---------------------------------------- Bug #8109: FileUtils.mv fails across devices on Windows https://bugs.ruby-lang.org/issues/8109#change-37689 Author: mitchellh (Mitchell Hashimoto) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 2.0.0-p0 Reproduction code: https://gist.github.com/luislavena/5179408 The issue is that Ruby is using MoveFile under the covers: http://msdn.microsoft.com/en-us/library/windows/de... Quote directly from the MoveFile docs: "The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume." Instead, MoveFileEx should be used with the MOVEFILE_COPY_ALLOWED flag. This function has existed since XP, and since Ruby 1.9 is XP+, we can safely switch to this: http://msdn.microsoft.com/en-us/library/windows/de... The MoveFileEx call with the proper flag will just do the right thing.
on 2013-03-19 12:15
Issue #8109 has been updated by usa (Usaku NAKAMURA). How reproduce this? I cannot reproduce on Windows 7 (x64). (The target volume is FAT32 on USB memory.) Need network drive, or others? ---------------------------------------- Bug #8109: FileUtils.mv fails across devices on Windows https://bugs.ruby-lang.org/issues/8109#change-37731 Author: mitchellh (Mitchell Hashimoto) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 2.0.0-p0 Reproduction code: https://gist.github.com/luislavena/5179408 The issue is that Ruby is using MoveFile under the covers: http://msdn.microsoft.com/en-us/library/windows/de... Quote directly from the MoveFile docs: "The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume." Instead, MoveFileEx should be used with the MOVEFILE_COPY_ALLOWED flag. This function has existed since XP, and since Ruby 1.9 is XP+, we can safely switch to this: http://msdn.microsoft.com/en-us/library/windows/de... The MoveFileEx call with the proper flag will just do the right thing.
on 2013-03-19 13:46
Issue #8109 has been updated by luislavena (Luis Lavena). Category set to platform/windows Assignee set to cruby-windows usa (Usaku NAKAMURA) wrote: > How reproduce this? > I cannot reproduce on Windows 7 (x64). > (The target volume is FAT32 on USB memory.) > > Need network drive, or others? Dunno about moving from NTFS to FAT32, but I used ImDisk (a ram drive) to create a ntfs drive, then: require "fileutils" Dir.mkdir "C:/somedirectory" FileUtils.mv "C:/somedirectory", "V:/another" This fails because it relies on File.rename which uses FileMoveW and is not causing cross-device link error, but instead access denied, as "move" does in the Command Prompt Since we use FileMoveEx anyway if the target file exists, perhaps we can directly use FileMoveEx all the way and use MOVEFILE_COPY_ALLOWED combined with MOVEFILE_REPLACE_EXISTING if necessary. ---------------------------------------- Bug #8109: FileUtils.mv fails across devices on Windows https://bugs.ruby-lang.org/issues/8109#change-37734 Author: mitchellh (Mitchell Hashimoto) Status: Open Priority: Normal Assignee: cruby-windows Category: platform/windows Target version: ruby -v: 2.0.0-p0 Reproduction code: https://gist.github.com/luislavena/5179408 The issue is that Ruby is using MoveFile under the covers: http://msdn.microsoft.com/en-us/library/windows/de... Quote directly from the MoveFile docs: "The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume." Instead, MoveFileEx should be used with the MOVEFILE_COPY_ALLOWED flag. This function has existed since XP, and since Ruby 1.9 is XP+, we can safely switch to this: http://msdn.microsoft.com/en-us/library/windows/de... The MoveFileEx call with the proper flag will just do the right thing.
on 2013-03-30 14:00
Issue #8109 has been updated by nagachika (Tomoyuki Chikanaga). Hello, usa san, it seems a long-standing bug, isn't it? Do you want to backport r40001 to 1.9.3 branch? I will take a leaf from your opinion for 2.0.0. Thanks. ---------------------------------------- Bug #8109: FileUtils.mv fails across devices on Windows https://bugs.ruby-lang.org/issues/8109#change-38052 Author: mitchellh (Mitchell Hashimoto) Status: Closed Priority: Normal Assignee: cruby-windows Category: platform/windows Target version: ruby -v: 2.0.0-p0 Reproduction code: https://gist.github.com/luislavena/5179408 The issue is that Ruby is using MoveFile under the covers: http://msdn.microsoft.com/en-us/library/windows/de... Quote directly from the MoveFile docs: "The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume." Instead, MoveFileEx should be used with the MOVEFILE_COPY_ALLOWED flag. This function has existed since XP, and since Ruby 1.9 is XP+, we can safely switch to this: http://msdn.microsoft.com/en-us/library/windows/de... The MoveFileEx call with the proper flag will just do the right thing.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.