Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1111)

Issue 8203043: code review 8203043: syscall: Use FILE_SHARE_DELETE flag when opening files ...

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by fdmanana
Modified:
10 years, 4 months ago
CC:
golang-codereviews
Visibility:
Public.

Description

syscall: Use FILE_SHARE_DELETE flag when opening files on Windows On Windows, a file opened without the FILE_SHARE_DELETE flag can not be renamed or deleted until it's closed. This contrasts with the semantics on POSIX systems (GNU/Linux, Mac OS X, etc). Since there's no way to specify such flag in the Open() call, this is necessary to ensure the same Go code behaves the same on all platforms. Opening a file on Windows and then attempting to rename it or delete it, from any Go thread or from an external process, resulted in a Windows ERROR_SHARING_VIOLATION error. This same type of issue happened for example in Erlang OTP's file driver: https://github.com/erlang/otp/commit/0e02f488971b32ff9ab88a3f0cb144fe5db161b2

Patch Set 1 #

Patch Set 2 : diff -r 946f0a049860 https://code.google.com/p/go #

Patch Set 3 : diff -r 946f0a049860 https://code.google.com/p/go #

Patch Set 4 : diff -r 946f0a049860 https://code.google.com/p/go #

Patch Set 5 : diff -r 946f0a049860 https://code.google.com/p/go #

Patch Set 6 : diff -r 946f0a049860 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -1 line) Patch
M src/pkg/os/os_test.go View 1 2 3 4 5 1 chunk +32 lines, -0 lines 0 comments Download
M src/pkg/syscall/syscall_windows.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 18
fdmanana
On Windows, a file opened without the FILE_SHARE_FLAG can not be renamed or deleted until ...
11 years, 1 month ago (2013-03-30 21:25:03 UTC) #1
fdmanana
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
11 years, 1 month ago (2013-03-30 21:51:19 UTC) #2
bradfitz
Interesting. Is this widely supported in Windows across versions? Add a test? Leaving for Windows ...
11 years, 1 month ago (2013-03-31 03:23:25 UTC) #3
aram
I am unconvinced this is the correct thing to do. To quote Rob here: https://groups.google.com/d/msg/golang-dev/TlLZoZjJuCk/oQKXUkzGhoEJ ...
11 years, 1 month ago (2013-03-31 10:00:23 UTC) #4
fdmanana
On Sun, Mar 31, 2013 at 11:00 AM, Aram Hăvărneanu <aram@mgk.ro> wrote: > I am ...
11 years, 1 month ago (2013-03-31 11:39:25 UTC) #5
fdmanana
Hello golang-dev@googlegroups.com, bradfitz@golang.org, aram@mgk.ro (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 1 month ago (2013-03-31 11:42:29 UTC) #6
fdmanana
Hello golang-dev@googlegroups.com, bradfitz@golang.org, aram@mgk.ro (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 1 month ago (2013-03-31 11:45:52 UTC) #7
aram
> Renaming or deleting an open file, is not an uncommon thing to do. > ...
11 years, 1 month ago (2013-03-31 12:18:03 UTC) #8
fdmanana
On Sun, Mar 31, 2013 at 1:18 PM, Aram Hăvărneanu <aram@mgk.ro> wrote: > > Just ...
11 years, 1 month ago (2013-03-31 12:30:51 UTC) #9
minux1
On Sun, Mar 31, 2013 at 8:30 PM, Filipe David Manana <fdmanana@gmail.com> wrote: > Imho, ...
11 years, 1 month ago (2013-03-31 14:52:34 UTC) #10
fdmanana
On Sun, Mar 31, 2013 at 3:52 PM, minux <minux.ma@gmail.com> wrote: > On Sun, Mar ...
11 years, 1 month ago (2013-03-31 15:27:08 UTC) #11
minux1
cc: +alex.brainman, maybe he could tell you why FILE_SHARE_DELETE is not used in syscall.Open. On ...
11 years, 1 month ago (2013-03-31 16:08:37 UTC) #12
aram
> why does Open() (and OpenFile()) always, and unconditionally, pass > FILE_SHARE_READ and FILE_SHARE_WRITE to ...
11 years, 1 month ago (2013-03-31 16:17:23 UTC) #13
aram
Heh, Minux beat me to it, but I'm amazed by the similarities of our answers.
11 years, 1 month ago (2013-03-31 16:18:31 UTC) #14
fdmanana
On Sun, Mar 31, 2013 at 5:08 PM, minux <minux.ma@gmail.com> wrote: > cc: +alex.brainman, maybe ...
11 years, 1 month ago (2013-03-31 16:24:43 UTC) #15
brainman
On 2013/03/31 16:08:37, minux wrote: > cc: +alex.brainman, maybe he could tell you why FILE_SHARE_DELETE ...
11 years, 1 month ago (2013-04-01 03:24:06 UTC) #16
gobot
Replacing golang-dev with golang-codereviews.
10 years, 4 months ago (2013-12-20 16:21:40 UTC) #17
bradfitz
10 years, 4 months ago (2014-01-16 19:32:17 UTC) #18
R=close

Sounds like there was consensus against this. Closing to clean up the dashboard.
Please re-open if people disagree.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b