-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows os.Rename bad #3366
Labels
Comments
As far as I know, there is no way to handle os.Rename such that it is equivalent on Windows and POSIX systems. In particular, on POSIX os.Rename is atomic, in the sense that if the destination path already exists, any other process can always open the destination path and get either the old file or the new file. Since we can't provide identical semantics on different operating systems, I don't think we should try to go beyond what the OS provides. There is no one right choice. Status changed to WorkingAsIntended. |
Issue #5620 has been merged into this issue. |
I recommend this bug be reopened and reconsidered. Other languages have encountered and tackled this problem successfully in Windows. As one example, the report of the same issue in Python led to a detailed discussion and ultimately had a successful resolution (http://bugs.python.org/issue8828). The resolution of this bug in other Go projects follows the same pattern - effectively creating an os.Replace() function for this circumstance, using the Windows MoveFileEx api. Whether os.Rename() is enhanced to properly handle Windows cases or a new os.Replace() function is created that satisfies the same criteria, it would prevent everyone from re-inventing the same wheel virtually the same way simply to sidestep this bug. |
Understood. I've created a new issue #8914 for this purpose. |
tv42
added a commit
to tv42/go-datastore
that referenced
this issue
Apr 24, 2015
…Ex directly For background, see golang/go#3366 Here's the failure seen: --- FAIL: TestPutOverwrite (0.03s) flatfs_test.go:118: Put fail: rename C:\Users\gates\AppData\Local\Temp\test-datastore-flatfs-679014441\7175\put- 717454915 C:\Users\gates\AppData\Local\Temp\test-datastore-flatfs-679014441/7175/71757578.data: Cannot create a file when that file already exists.
tv42
added a commit
to tv42/go-datastore
that referenced
this issue
Apr 25, 2015
…Ex directly For background, see golang/go#3366 Here's the failure seen: --- FAIL: TestPutOverwrite (0.03s) flatfs_test.go:118: Put fail: rename C:\Users\gates\AppData\Local\Temp\test-datastore-flatfs-679014441\7175\put- 717454915 C:\Users\gates\AppData\Local\Temp\test-datastore-flatfs-679014441/7175/71757578.data: Cannot create a file when that file already exists.
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by kfox1111:
The text was updated successfully, but these errors were encountered: