[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 Alex R�nne Petersen changed: What|Removed |Added Status|ASSIGNED|RESOLVED CC||a...@lycus.org Resolution||FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 --- Comment #9 from github-bugzi...@puremagic.com 2013-03-11 22:03:51 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/7d35ad4953d6dd24857bb978219183abce266f4a std.file: Make rename clobber on Windows, adjust docs (Issue 5032) https://github.com/D-Programming-Language/phobos/commit/bba5dbe1c6ab5bb32432d6e7d8fd960713b04163 Merge pull request #1198 from CyberShadow/fix5032 std.file: Fix/document/test clobber behavior for copy and rename (Issue 5032) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 Vladimir Panteleev changed: What|Removed |Added Keywords||pull --- Comment #8 from Vladimir Panteleev 2013-03-11 05:16:13 EET --- (In reply to comment #6) > Atomicity is not a concern as much as a gating factor. How to implement the > clobber option "no" on Unix? Good point. > This is rename. It must clobber the target on both Windows and Unix. Yep, I mentioned copy earlier as they're related. https://github.com/D-Programming-Language/phobos/pull/1198 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 --- Comment #6 from Andrei Alexandrescu 2013-03-10 19:58:51 PDT --- (In reply to comment #5) > I think a clobber option with the default set to "no" would be better. > Atomicity is a valid concern, but I don't think the default behavior should > imply the risk of accidentally overwriting files. Atomicity is not a concern as much as a gating factor. How to implement the clobber option "no" on Unix? > It's too late to change the behavior of "copy", and atomicity does not apply > to > it anyway. This is remove. It must clobber the target on both Windows and Unix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 --- Comment #7 from Andrei Alexandrescu 2013-03-10 19:59:12 PDT --- (In reply to comment #6) > (In reply to comment #5) > > I think a clobber option with the default set to "no" would be better. > > Atomicity is a valid concern, but I don't think the default behavior should > > imply the risk of accidentally overwriting files. > > Atomicity is not a concern as much as a gating factor. How to implement the > clobber option "no" on Unix? > > > It's too late to change the behavior of "copy", and atomicity does not > > apply to > > it anyway. > > This is remove. It must clobber the target on both Windows and Unix. I mean "This is rename." :o) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 --- Comment #5 from Vladimir Panteleev 2013-03-11 04:53:21 EET --- I think a clobber option with the default set to "no" would be better. Atomicity is a valid concern, but I don't think the default behavior should imply the risk of accidentally overwriting files. It's too late to change the behavior of "copy", and atomicity does not apply to it anyway. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 --- Comment #4 from Andrei Alexandrescu 2013-03-10 19:43:21 PDT --- No, rename must clobber. It's the only way things can be done atomically on Unix as far as I can tell. If we have code such as "if (!exists(target)) rename(source, target)" we have a race condition. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 Andrej Mitrovic changed: What|Removed |Added CC||andrej.mitrov...@gmail.com --- Comment #3 from Andrej Mitrovic 2013-03-10 19:14:02 PDT --- (In reply to comment #2) > Is that the right thing to do, though? I'd expect the function to throw if the > target exists. Doesn't help that the docs for either "copy" and "rename" do > not > specify what it does in that situation. Yeah I agree. If anything make the forced renaming an option, not a default behavior. That's how most tools work on win32 anyway, dunno about Posix though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 Vladimir Panteleev changed: What|Removed |Added CC||thecybersha...@gmail.com --- Comment #2 from Vladimir Panteleev 2013-03-11 04:03:41 EET --- Is that the right thing to do, though? I'd expect the function to throw if the target exists. Doesn't help that the docs for either "copy" and "rename" do not specify what it does in that situation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 --- Comment #1 from Andrei Alexandrescu 2013-03-10 18:58:36 PDT --- Could somebody with access to a Windows machine change std.file.rename to overwrite the target? I see in http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx that MoveFileEx offers such a flag. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5032] std.file.rename acts differently on Windows and Linux when the target file already exists.
http://d.puremagic.com/issues/show_bug.cgi?id=5032 Andrei Alexandrescu changed: What|Removed |Added Status|NEW |ASSIGNED CC||and...@metalanguage.com AssignedTo|nob...@puremagic.com|and...@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---