Backport #8109
closed
=begin
Why Windows returns (({ERROR_ACCESS_DENIED})) on cross-device link for directory, while (({ERROR_NOT_SAME_DEVICE})) for file?
=end
How reproduce this?
I cannot reproduce on Windows 7 (x64).
(The target volume is FAT32 on USB memory.)
Need network drive, or others?
- Category set to platform/windows
- Assignee set to 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.
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r40001.
Mitchell, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- win32/win32.c (wrename): use MoveFileExW instead of MoveFileW,
because the latter fails on cross device file move of some
environments.
fix [ruby-core:53492] [Bug #8109]
reported by mitchellh (Mitchell Hashimoto)
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.
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport200
- Category deleted (
platform/windows)
- Status changed from Closed to Assigned
- Assignee changed from windows to nagachika (Tomoyuki Chikanaga)
Sorry for late reply.
I should backport it to 1.9.3 (see #8609).
- Status changed from Assigned to Closed
This issue was solved with changeset r42375.
Mitchell, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 40001: [Backport #8109]
* win32/win32.c (wrename): use MoveFileExW instead of MoveFileW,
because the latter fails on cross device file move of some
environments.
fix [ruby-core:53492] [Bug #8109]
reported by mitchellh (Mitchell Hashimoto)
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0