[go] syscall: support O_SYNC flag for os.OpenFile on windows

117 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
May 25, 2020, 1:38:07 PM5/25/20
to Ibrahim Jarif, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot would like Ibrahim Jarif to review this change.

View Change

syscall: support O_SYNC flag for os.OpenFile on windows

The current implementation of `os.OpenFile` function for windows does
not use the O_SYNC flag. This means that even if the user has set the
`O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
which is the equivalent of `O_SYNC` flag on Linux.

Fixes https://github.com/golang/go/issues/35358

Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
GitHub-Last-Rev: 59d970ff677cc864165e31dd621c277cf799960a
GitHub-Pull-Request: golang/go#39245
---
M src/syscall/syscall_windows.go
M src/syscall/types_windows.go
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index f62c00d..00fb61f 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -336,7 +336,7 @@
default:
createmode = OPEN_EXISTING
}
- var attrs uint32 = FILE_ATTRIBUTE_NORMAL
+ var attrsAndFlags uint32 = FILE_ATTRIBUTE_NORMAL
if perm&S_IWRITE == 0 {
attrs = FILE_ATTRIBUTE_READONLY
if createmode == CREATE_ALWAYS {
@@ -360,6 +360,11 @@
}
}
}
+
+ if mode&O_SYNC != 0 {
+ attrsAndFlags != FILE_FLAG_WRITE_THROUGH
+ }
+
h, e := CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0)
return h, e
}
diff --git a/src/syscall/types_windows.go b/src/syscall/types_windows.go
index 0349f3b..10bf2e9 100644
--- a/src/syscall/types_windows.go
+++ b/src/syscall/types_windows.go
@@ -114,6 +114,7 @@
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
FILE_FLAG_OVERLAPPED = 0x40000000
+ FILE_FLAG_WRITE_THROUGH = 0x80000000

HANDLE_FLAG_INHERIT = 0x00000001
STARTF_USESTDHANDLES = 0x00000100

To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
Gerrit-Change-Number: 235198
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
Gerrit-MessageType: newchange

Gobot Gobot (Gerrit)

unread,
May 25, 2020, 1:38:25 PM5/25/20
to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.

View Change

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-Comment-Date: Mon, 25 May 2020 17:38:20 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Gerrit Bot (Gerrit)

    unread,
    May 26, 2020, 4:02:06 PM5/26/20
    to Ibrahim Jarif, goph...@pubsubhelper.golang.org, Gobot Gobot, golang-co...@googlegroups.com

    Gerrit Bot uploaded patch set #2 to this change.

    View Change

    syscall: support O_SYNC flag for os.OpenFile on windows

    The current implementation of `os.OpenFile` function for windows does
    not use the O_SYNC flag. This means that even if the user has set the
    `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
    commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
    which is the equivalent of `O_SYNC` flag on Linux.

    Fixes https://github.com/golang/go/issues/35358

    Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    GitHub-Last-Rev: 0a1a504fc27f345bd37fd48713f8f4fa9bffcf2d

    GitHub-Pull-Request: golang/go#39245
    ---
    M src/syscall/syscall_windows.go
    M src/syscall/types_windows.go
    2 files changed, 7 insertions(+), 1 deletion(-)

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-MessageType: newpatchset

    Emmanuel Odeke (Gerrit)

    unread,
    May 30, 2020, 7:27:07 PM5/30/20
    to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, Gobot Gobot, golang-co...@googlegroups.com

    Thank you for this change, Ibrahim and welcome to the Go project!

    We are currently in a code freeze, so this change will be submitted
    after August 2020, but it looks good. I have added some suggestions, but
    also I am going to tag some folks to be aware of it.

    Thank you again.

    View Change

    2 comments:

      • The current implementation of `os.OpenFile` function for windows does
        not use the O_SYNC flag. This means that even if the user has set the
        `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
        commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
        which is the equivalent of `O_SYNC` flag on Linux.

        Fixes https://github.com/golang/go/issues/35358

      • So while Github serves as a bridge for creating change lists, the actual changes are made on Gerrit. We don't use Markdown in messages so we'll need to remove the backticking in messages, to perhaps make your commit message the following, below:

        os.OpenFile on windows did not use the O_SYNC flag. This meant
        that even if the user set O_SYNC, os.OpenFile would ignore it.

        This change adds a new flag FILE_FLAG_WRITE_THROUGH, which is
        the equivalent of O_SYNC flag on Linux and is documented in
        https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea

        Fixes #35358

    • File src/syscall/syscall_windows.go:


      • }

        h, e := CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0)

      • Does this change compile?
        Where are we using attrsAndFlags? Also attrs is now undefined.
        I'd leave the variable name as is.

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
    Gerrit-CC: Emmanuel Odeke <emm....@gmail.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Liam Breck <networ...@gmail.com>
    Gerrit-Comment-Date: Sat, 30 May 2020 23:27:01 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Gerrit Bot (Gerrit)

    unread,
    Jun 1, 2020, 5:40:14 AM6/1/20
    to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, goph...@pubsubhelper.golang.org, Liam Breck, Gobot Gobot, Ian Lance Taylor, Emmanuel Odeke, golang-co...@googlegroups.com

    Gerrit Bot uploaded patch set #3 to this change.

    View Change

    syscall: support O_SYNC flag for os.OpenFile on windows

    The current implementation of `os.OpenFile` function for windows does
    not use the O_SYNC flag. This means that even if the user has set the
    `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
    commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
    which is the equivalent of `O_SYNC` flag on Linux.

    Fixes https://github.com/golang/go/issues/35358

    Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    GitHub-Last-Rev: d83f325f8b55a578991db640a950bf06b41a2708

    GitHub-Pull-Request: golang/go#39245
    ---
    M src/syscall/syscall_windows.go
    M src/syscall/types_windows.go
    2 files changed, 6 insertions(+), 0 deletions(-)

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
    Gerrit-CC: Emmanuel Odeke <emm....@gmail.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Liam Breck <networ...@gmail.com>
    Gerrit-MessageType: newpatchset

    Alex Brainman (Gerrit)

    unread,
    Jun 8, 2020, 1:44:27 AM6/8/20
    to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, Emmanuel Odeke, Gobot Gobot, golang-co...@googlegroups.com

    Thank you, Ibrahim, for fixing this problem.

    This change needs some test. Otherwise how do we know that we are fixing the problem? It would be nice to have a test that can run every time, but I don't see how we can construct reliable test for this (maybe you or anyone else have ideas). Perhaps you can compare time it takes to write file with O_SYNC and without. Maybe have test skipped by default, but have some flag that reviewer can run the test manually, if they want.

    Alex

    View Change

    3 comments:

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
    Gerrit-CC: Emmanuel Odeke <emm....@gmail.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Liam Breck <networ...@gmail.com>
    Gerrit-Comment-Date: Mon, 08 Jun 2020 05:44:20 +0000

    Gerrit Bot (Gerrit)

    unread,
    Jul 2, 2020, 3:54:18 AM7/2/20
    to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, goph...@pubsubhelper.golang.org, Liam Breck, Gobot Gobot, Ian Lance Taylor, Emmanuel Odeke, golang-co...@googlegroups.com

    Gerrit Bot uploaded patch set #4 to this change.

    View Change

    syscall: support O_SYNC flag for os.OpenFile on windows

    The current implementation of `os.OpenFile` function for windows does
    not use the O_SYNC flag. This means that even if the user has set the
    `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
    commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
    which is the equivalent of `O_SYNC` flag on Linux.

    Fixes https://github.com/golang/go/issues/35358

    Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    GitHub-Last-Rev: 2608e6c853815ee7596062a0d804f8a79bf5e79a

    GitHub-Pull-Request: golang/go#39245
    ---
    M src/syscall/syscall_windows.go
    1 file changed, 5 insertions(+), 0 deletions(-)

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
    Gerrit-CC: Emmanuel Odeke <emm....@gmail.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Liam Breck <networ...@gmail.com>
    Gerrit-MessageType: newpatchset

    Emmanuel Odeke (Gerrit)

    unread,
    Jul 2, 2020, 4:16:51 AM7/2/20
    to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, Gobot Gobot, golang-co...@googlegroups.com

    Patch set 4:Run-TryBot +1

    View Change

    1 comment:

    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
    Gerrit-Change-Number: 235198
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
    Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
    Gerrit-CC: Gobot Gobot <go...@golang.org>
    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Liam Breck <networ...@gmail.com>
    Gerrit-Comment-Date: Thu, 02 Jul 2020 08:16:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Gobot Gobot (Gerrit)

    unread,
    Jul 2, 2020, 4:17:06 AM7/2/20
    to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

    TryBots beginning. Status page: https://farmer.golang.org/try?commit=ced6cbff

    View Change

      To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
      Gerrit-Change-Number: 235198
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
      Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
      Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
      Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
      Gerrit-CC: Gobot Gobot <go...@golang.org>
      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
      Gerrit-CC: Liam Breck <networ...@gmail.com>
      Gerrit-Comment-Date: Thu, 02 Jul 2020 08:17:01 +0000

      Gobot Gobot (Gerrit)

      unread,
      Jul 2, 2020, 4:19:30 AM7/2/20
      to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

      Build is still in progress...
      This change failed on windows-amd64-2016:
      See https://storage.googleapis.com/go-build-log/ced6cbff/windows-amd64-2016_830476be.log

      Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.

      View Change

        To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
        Gerrit-Change-Number: 235198
        Gerrit-PatchSet: 4
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
        Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
        Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
        Gerrit-CC: Gobot Gobot <go...@golang.org>
        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Liam Breck <networ...@gmail.com>
        Gerrit-Comment-Date: Thu, 02 Jul 2020 08:19:24 +0000

        Gobot Gobot (Gerrit)

        unread,
        Jul 2, 2020, 4:27:56 AM7/2/20
        to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

        2 of 20 TryBots failed:
        Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/ced6cbff/windows-amd64-2016_830476be.log
        Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/ced6cbff/windows-386-2008_886adf6a.log

        Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.

        Patch set 4:TryBot-Result -1

        View Change

          To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
          Gerrit-Change-Number: 235198
          Gerrit-PatchSet: 4
          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
          Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
          Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
          Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
          Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
          Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
          Gerrit-CC: Liam Breck <networ...@gmail.com>
          Gerrit-Comment-Date: Thu, 02 Jul 2020 08:27:50 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          Gerrit-MessageType: comment

          Gerrit Bot (Gerrit)

          unread,
          Jul 2, 2020, 4:45:11 AM7/2/20
          to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, Gobot Gobot, Emmanuel Odeke, goph...@pubsubhelper.golang.org, Liam Breck, Ian Lance Taylor, golang-co...@googlegroups.com

          Gerrit Bot uploaded patch set #5 to this change.

          View Change

          syscall: support O_SYNC flag for os.OpenFile on windows

          The current implementation of `os.OpenFile` function for windows does
          not use the O_SYNC flag. This means that even if the user has set the
          `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
          commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
          which is the equivalent of `O_SYNC` flag on Linux.

          Fixes https://github.com/golang/go/issues/35358

          Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
          GitHub-Last-Rev: b8165e448b9957b941825c16487cb9277fd76058

          GitHub-Pull-Request: golang/go#39245
          ---
          M src/syscall/syscall_windows.go
          1 file changed, 4 insertions(+), 0 deletions(-)

          To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
          Gerrit-Change-Number: 235198
          Gerrit-PatchSet: 5
          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
          Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
          Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
          Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
          Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
          Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
          Gerrit-CC: Liam Breck <networ...@gmail.com>
          Gerrit-MessageType: newpatchset

          Emmanuel Odeke (Gerrit)

          unread,
          Jul 2, 2020, 5:07:12 AM7/2/20
          to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Gobot Gobot, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

          Patch Set 4:

          (1 comment)

          Patch Set 4: TryBot-Result-1

          2 of 20 TryBots failed:
          Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/ced6cbff/windows-amd64-2016_830476be.log
          Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/ced6cbff/windows-386-2008_886adf6a.log

          Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.

          The 386 build for windows failed with
          C:\workdir\go\src\syscall\syscall_windows.go:339:27: constant 2147483648 overflows int

          How do I save a 0x80000000 in an int? The integer value is 2147483648 which won't fit in an 386 int.

          There are 2 problems:
          a) You are declaring a constant whose default type is int, it needs to be uint32 as attrs is so that the bit set operation will work -- this is failing on both builders
          b) If you use: const _FILE_FLAG_WRITE_THROUGH uint32 = 0x80000000 that should cut the deal and not overflow

          View Change

            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
            Gerrit-Change-Number: 235198
            Gerrit-PatchSet: 5
            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
            Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
            Gerrit-CC: Liam Breck <networ...@gmail.com>
            Gerrit-Comment-Date: Thu, 02 Jul 2020 09:07:06 +0000

            Gerrit Bot (Gerrit)

            unread,
            Jul 2, 2020, 5:42:39 AM7/2/20
            to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, Gobot Gobot, Emmanuel Odeke, goph...@pubsubhelper.golang.org, Liam Breck, Ian Lance Taylor, golang-co...@googlegroups.com

            Gerrit Bot uploaded patch set #6 to this change.

            View Change

            syscall: support O_SYNC flag for os.OpenFile on windows

            The current implementation of `os.OpenFile` function for windows does
            not use the O_SYNC flag. This means that even if the user has set the
            `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
            commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
            which is the equivalent of `O_SYNC` flag on Linux.

            Fixes https://github.com/golang/go/issues/35358

            Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
            GitHub-Last-Rev: c3638fa2031406ae26f6a87da7e299382babf652

            GitHub-Pull-Request: golang/go#39245
            ---
            M src/syscall/syscall_windows.go
            1 file changed, 4 insertions(+), 0 deletions(-)

            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
            Gerrit-Change-Number: 235198
            Gerrit-PatchSet: 6
            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
            Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
            Gerrit-CC: Liam Breck <networ...@gmail.com>
            Gerrit-MessageType: newpatchset

            Emmanuel Odeke (Gerrit)

            unread,
            Jul 2, 2020, 5:43:36 AM7/2/20
            to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Gobot Gobot, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

            Patch Set 5:

            Patch Set 5:

            Patch Set 4:

            (1 comment)

            Patch Set 4: TryBot-Result-1

            2 of 20 TryBots failed:
            Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/ced6cbff/windows-amd64-2016_830476be.log
            Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/ced6cbff/windows-386-2008_886adf6a.log

            Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.

            The 386 build for windows failed with
            C:\workdir\go\src\syscall\syscall_windows.go:339:27: constant 2147483648 overflows int

            How do I save a 0x80000000 in an int? The integer value is 2147483648 which won't fit in an 386 int.

            There are 2 problems:
            a) You are declaring a constant whose default type is int, it needs to be uint32 as attrs is so that the bit set operation will work -- this is failing on both builders
            b) If you use: const _FILE_FLAG_WRITE_THROUGH uint32 = 0x80000000 that should cut the deal and not overflow

            Thank you so much. I made the change. The const is declared where we're using it. Do you think it's better to decalare it at the top of the file? I chose to keep it close to where it's being used.

            Where you have it is alright for now since that's the only call site :)

            Patch set 6:Run-TryBot +1

            View Change

              To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

              Gerrit-Project: go
              Gerrit-Branch: master
              Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
              Gerrit-Change-Number: 235198
              Gerrit-PatchSet: 6
              Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
              Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
              Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
              Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
              Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
              Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
              Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
              Gerrit-CC: Liam Breck <networ...@gmail.com>
              Gerrit-Comment-Date: Thu, 02 Jul 2020 09:43:32 +0000

              Gobot Gobot (Gerrit)

              unread,
              Jul 2, 2020, 5:44:24 AM7/2/20
              to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

              TryBots beginning. Status page: https://farmer.golang.org/try?commit=6eac7a23

              View Change

                To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                Gerrit-Change-Number: 235198
                Gerrit-PatchSet: 6
                Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                Gerrit-CC: Liam Breck <networ...@gmail.com>
                Gerrit-Comment-Date: Thu, 02 Jul 2020 09:44:19 +0000

                Gobot Gobot (Gerrit)

                unread,
                Jul 2, 2020, 5:54:55 AM7/2/20
                to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                TryBots are happy.

                Patch set 6:TryBot-Result +1

                View Change

                  To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  Gerrit-Change-Number: 235198
                  Gerrit-PatchSet: 6
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                  Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                  Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                  Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                  Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                  Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                  Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-CC: Liam Breck <networ...@gmail.com>
                  Gerrit-Comment-Date: Thu, 02 Jul 2020 09:54:48 +0000

                  Gerrit Bot (Gerrit)

                  unread,
                  Jul 2, 2020, 5:56:12 AM7/2/20
                  to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, Gobot Gobot, Emmanuel Odeke, goph...@pubsubhelper.golang.org, Liam Breck, Ian Lance Taylor, golang-co...@googlegroups.com

                  Gerrit Bot uploaded patch set #7 to this change.

                  View Change

                  syscall: support O_SYNC flag for os.OpenFile on windows

                  The current implementation of `os.OpenFile` function for windows does
                  not use the O_SYNC flag. This means that even if the user has set the
                  `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
                  commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
                  which is the equivalent of `O_SYNC` flag on Linux.

                  Fixes https://github.com/golang/go/issues/35358

                  Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  GitHub-Last-Rev: f248698f989835190c20ce80c9640621a2802173

                  GitHub-Pull-Request: golang/go#39245
                  ---
                  M src/syscall/syscall_windows.go
                  1 file changed, 4 insertions(+), 0 deletions(-)

                  To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  Gerrit-Change-Number: 235198
                  Gerrit-PatchSet: 7
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                  Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                  Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                  Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                  Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                  Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                  Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                  Gerrit-CC: Liam Breck <networ...@gmail.com>
                  Gerrit-MessageType: newpatchset

                  Gerrit Bot (Gerrit)

                  unread,
                  Jul 2, 2020, 5:58:02 AM7/2/20
                  to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, Gobot Gobot, Emmanuel Odeke, goph...@pubsubhelper.golang.org, Liam Breck, Ian Lance Taylor, golang-co...@googlegroups.com

                  Gerrit Bot uploaded patch set #8 to this change.

                  View Change

                  syscall: support O_SYNC flag for os.OpenFile on windows

                  The current implementation of `os.OpenFile` function for windows does
                  not use the O_SYNC flag. This means that even if the user has set the
                  `O_SYNC flag`, the `os.OpenFile` call will ignore the `SYNC` flag. This
                  commit fixes the issue by adding the `FILE_FLAG_WRITE_THROUGH`
                  which is the equivalent of `O_SYNC` flag on Linux.

                  Fixes #35358.

                  Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  GitHub-Last-Rev: f248698f989835190c20ce80c9640621a2802173

                  GitHub-Pull-Request: golang/go#39245
                  ---
                  M src/syscall/syscall_windows.go
                  1 file changed, 4 insertions(+), 0 deletions(-)

                  To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  Gerrit-Change-Number: 235198
                  Gerrit-PatchSet: 8
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>

                  Gerrit Bot (Gerrit)

                  unread,
                  Jul 2, 2020, 5:59:44 AM7/2/20
                  to Ibrahim Jarif, Jason A. Donenfeld, Alex Brainman, Gobot Gobot, Emmanuel Odeke, goph...@pubsubhelper.golang.org, Liam Breck, Ian Lance Taylor, golang-co...@googlegroups.com

                  Gerrit Bot uploaded patch set #9 to this change.

                  View Change

                  syscall: support O_SYNC flag for os.OpenFile on windows

                  The current implementation of os.OpenFile function for windows does
                  not use the O_SYNC flag. This means that even if the user has set the
                  O_SYNC flag, the os.OpenFile call will ignore the SYNC flag. This
                  change adds _FILE_FLAG_WRITE_THROUGH, the equivalent of
                  O_SYNC flag on Linux.

                  Fixes #35358.

                  Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  GitHub-Last-Rev: f248698f989835190c20ce80c9640621a2802173
                  GitHub-Pull-Request: golang/go#39245
                  ---
                  M src/syscall/syscall_windows.go
                  1 file changed, 4 insertions(+), 0 deletions(-)

                  To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                  Gerrit-Change-Number: 235198
                  Gerrit-PatchSet: 9
                  Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>

                  Emmanuel Odeke (Gerrit)

                  unread,
                  Jul 2, 2020, 6:02:43 AM7/2/20
                  to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Gobot Gobot, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                  Patch set 9:Run-TryBot +1

                  View Change

                    To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                    Gerrit-Project: go
                    Gerrit-Branch: master
                    Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                    Gerrit-Change-Number: 235198
                    Gerrit-PatchSet: 9
                    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                    Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                    Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                    Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                    Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                    Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                    Gerrit-CC: Liam Breck <networ...@gmail.com>
                    Gerrit-Comment-Date: Thu, 02 Jul 2020 10:02:38 +0000

                    Gobot Gobot (Gerrit)

                    unread,
                    Jul 2, 2020, 6:02:57 AM7/2/20
                    to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                    TryBots beginning. Status page: https://farmer.golang.org/try?commit=e618363c

                    View Change

                      To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                      Gerrit-Project: go
                      Gerrit-Branch: master
                      Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                      Gerrit-Change-Number: 235198
                      Gerrit-PatchSet: 9
                      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                      Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                      Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                      Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                      Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                      Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                      Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                      Gerrit-CC: Liam Breck <networ...@gmail.com>
                      Gerrit-Comment-Date: Thu, 02 Jul 2020 10:02:51 +0000

                      Gobot Gobot (Gerrit)

                      unread,
                      Jul 2, 2020, 6:14:18 AM7/2/20
                      to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                      TryBots are happy.

                      Patch set 9:TryBot-Result +1

                      View Change

                        To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                        Gerrit-Project: go
                        Gerrit-Branch: master
                        Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                        Gerrit-Change-Number: 235198
                        Gerrit-PatchSet: 9
                        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                        Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                        Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                        Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                        Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                        Gerrit-CC: Liam Breck <networ...@gmail.com>
                        Gerrit-Comment-Date: Thu, 02 Jul 2020 10:14:08 +0000

                        Ibrahim Jarif (Gerrit)

                        unread,
                        Jul 2, 2020, 1:17:09 PM7/2/20
                        to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, Emmanuel Odeke, Gobot Gobot, golang-co...@googlegroups.com

                        Patch Set 3:

                        (3 comments)

                        Thank you, Ibrahim, for fixing this problem.

                        This change needs some test. Otherwise how do we know that we are fixing the problem? It would be nice to have a test that can run every time, but I don't see how we can construct reliable test for this (maybe you or anyone else have ideas). Perhaps you can compare time it takes to write file with O_SYNC and without. Maybe have test skipped by default, but have some flag that reviewer can run the test manually, if they want.

                        Alex

                        Replied to all the review comments. It took me some time to figure my way around gerrit 😊

                        View Change

                        3 comments:

                          • Just […]

                            How do I do this? I can't change the PR description (I'm getting an error). Shall I squash all the commits and change the commit message?

                        • File src/syscall/syscall_windows.go:

                          • Patch Set #3, Line 351: h, e := CreateFile(pathp, access, sharemode, sa, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)

                            What about this CreateFile call?

                          • I don't think we can add new exported symbols to syscall package. See […]

                            Done. Moved into the open function.

                        To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                        Gerrit-Project: go
                        Gerrit-Branch: master
                        Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                        Gerrit-Change-Number: 235198
                        Gerrit-PatchSet: 3
                        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                        Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                        Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                        Gerrit-CC: Emmanuel Odeke <emm....@gmail.com>
                        Gerrit-CC: Gobot Gobot <go...@golang.org>
                        Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                        Gerrit-CC: Liam Breck <networ...@gmail.com>
                        Gerrit-Comment-Date: Thu, 02 Jul 2020 07:52:51 +0000
                        Gerrit-HasComments: Yes
                        Gerrit-Has-Labels: No
                        Comment-In-Reply-To: Alex Brainman <alex.b...@gmail.com>
                        Gerrit-MessageType: comment

                        Ibrahim Jarif (Gerrit)

                        unread,
                        Jul 2, 2020, 1:17:09 PM7/2/20
                        to Gerrit Bot, goph...@pubsubhelper.golang.org, Gobot Gobot, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                        Patch Set 5:

                        Patch Set 4:

                        (1 comment)

                        Patch Set 4: TryBot-Result-1

                        2 of 20 TryBots failed:
                        Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/ced6cbff/windows-amd64-2016_830476be.log
                        Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/ced6cbff/windows-386-2008_886adf6a.log

                        Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.

                        The 386 build for windows failed with
                        C:\workdir\go\src\syscall\syscall_windows.go:339:27: constant 2147483648 overflows int

                        How do I save a 0x80000000 in an int? The integer value is 2147483648 which won't fit in an 386 int.

                        There are 2 problems:
                        a) You are declaring a constant whose default type is int, it needs to be uint32 as attrs is so that the bit set operation will work -- this is failing on both builders
                        b) If you use: const _FILE_FLAG_WRITE_THROUGH uint32 = 0x80000000 that should cut the deal and not overflow

                        Thank you so much. I made the change. The const is declared where we're using it. Do you think it's better to decalare it at the top of the file? I chose to keep it close to where it's being used.

                        View Change

                          To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                          Gerrit-Project: go
                          Gerrit-Branch: master
                          Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                          Gerrit-Change-Number: 235198
                          Gerrit-PatchSet: 5
                          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                          Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                          Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                          Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                          Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                          Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                          Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                          Gerrit-CC: Liam Breck <networ...@gmail.com>
                          Gerrit-Comment-Date: Thu, 02 Jul 2020 09:42:25 +0000

                          Ibrahim Jarif (Gerrit)

                          unread,
                          Jul 2, 2020, 1:17:09 PM7/2/20
                          to Gerrit Bot, goph...@pubsubhelper.golang.org, Gobot Gobot, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                          Patch Set 4: TryBot-Result-1

                          2 of 20 TryBots failed:
                          Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/ced6cbff/windows-amd64-2016_830476be.log
                          Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/ced6cbff/windows-386-2008_886adf6a.log

                          Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test *exactly* your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed.

                          The 386 build for windows failed with
                          C:\workdir\go\src\syscall\syscall_windows.go:339:27: constant 2147483648 overflows int

                          How do I save a 0x80000000 in an int? The integer value is 2147483648 which won't fit in an 386 int.

                          View Change

                          1 comment:

                            • Done. Removed the new line.

                          To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                          Gerrit-Project: go
                          Gerrit-Branch: master
                          Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                          Gerrit-Change-Number: 235198
                          Gerrit-PatchSet: 4
                          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                          Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                          Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                          Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                          Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                          Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                          Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                          Gerrit-CC: Liam Breck <networ...@gmail.com>
                          Gerrit-Comment-Date: Thu, 02 Jul 2020 08:46:04 +0000
                          Gerrit-HasComments: Yes
                          Gerrit-Has-Labels: No
                          Comment-In-Reply-To: Emmanuel Odeke <emm....@gmail.com>
                          Gerrit-MessageType: comment

                          Ibrahim Jarif (Gerrit)

                          unread,
                          Jul 2, 2020, 1:17:09 PM7/2/20
                          to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, Emmanuel Odeke, Gobot Gobot, golang-co...@googlegroups.com

                          Patch Set 3:

                          (3 comments)

                          Thank you, Ibrahim, for fixing this problem.

                          This change needs some test. Otherwise how do we know that we are fixing the problem? It would be nice to have a test that can run every time, but I don't see how we can construct reliable test for this (maybe you or anyone else have ideas). Perhaps you can compare time it takes to write file with O_SYNC and without. Maybe have test skipped by default, but have some flag that reviewer can run the test manually, if they want.

                          Alex

                          Thanks Alex. I agree we need tests. As mentioned in the comment on github https://github.com/golang/go/pull/39245#issuecomment-633663387 (which I cannot fine here), I'm looking for help on writing test. Can you point me to an example of a similar test? Or maybe someone can help me write a test for this change.

                          View Change

                          1 comment:

                            • 	if mode&O_SYNC != 0 {
                              attrsAndFlags |= FILE_FLAG_WRITE_THROUGH
                              }

                              h, e := CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0)

                            • Does this change compile? […]

                              No, it won't compile. Thank you for catching it. How do I compile this code anyway? `go build` doesn't seem to work. Is there a simple way to compile the source?

                          To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                          Gerrit-Project: go
                          Gerrit-Branch: master
                          Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                          Gerrit-Change-Number: 235198
                          Gerrit-PatchSet: 3
                          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                          Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                          Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                          Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                          Gerrit-CC: Emmanuel Odeke <emm....@gmail.com>
                          Gerrit-CC: Gobot Gobot <go...@golang.org>
                          Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                          Gerrit-CC: Liam Breck <networ...@gmail.com>
                          Gerrit-Comment-Date: Thu, 02 Jul 2020 07:41:02 +0000

                          Alex Brainman (Gerrit)

                          unread,
                          Jul 4, 2020, 2:30:30 AM7/4/20
                          to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Gobot Gobot, Emmanuel Odeke, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                          ... I agree we need tests. As mentioned in the comment on github https://github.com/golang/go/pull/39245#issuecomment-633663387 (which I cannot fine here), I'm looking for help on writing test. Can you point me to an example of a similar test? Or maybe someone can help me write a test for this change.

                          Maybe we could use benchmark, like this one:

                          ```
                          diff --git a/src/os/os_test.go b/src/os/os_test.go
                          index e8c6451..5c710f0 100644
                          --- a/src/os/os_test.go
                          +++ b/src/os/os_test.go
                          @@ -2570,3 +2570,25 @@ func TestOpenFileKeepsPermissions(t *testing.T) {
                          t.Errorf("Stat after OpenFile is %v, should be writable", fi.Mode())
                          }
                          }
                          +
                          +func BenchmarkO_SYNC(b *testing.B) {
                          + tmpdir, err := ioutil.TempDir("", "BenchmarkO_SYNC")
                          + if err != nil {
                          + b.Fatal(err)
                          + }
                          + defer RemoveAll(tmpdir)
                          +
                          + path := filepath.Join(tmpdir, "a")
                          + f, err := OpenFile(path, O_SYNC|O_WRONLY|O_CREATE, 0666)
                          + if err != nil {
                          + b.Fatal(err)
                          + }
                          + defer f.Close()
                          +
                          + buf := bytes.Repeat([]byte("a"), 1<<20)
                          +
                          + _, err = f.Write(buf)
                          + if err != nil {
                          + b.Fatal(err)
                          + }
                          +}

                          ```

                          And then you can use

                          https://godoc.org/golang.org/x/tools/cmd/benchcmp

                          to compare benchmark result before your CL and after. Please, add benchcmp output to the CL commit message. We would expect to see BenchmarkO_SYNC takes much longer to execute after your CL is applied.

                          I think this will be good enough. If someone wants to run benchmark on their computer, they can.

                          It would be nice to still have some test. We can, for example, write a test that does something similar to BenchmarkO_SYNC, but twice: with os.O_SYNC and without. And then compare time it takes for each test. These times differ by thousands on my computer, so we can write a test to check that. But what, if someone else computer is different? We don't want to create flaky test.

                          I am happy with other suggestions.

                          Alex

                          View Change

                            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                            Gerrit-Project: go
                            Gerrit-Branch: master
                            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                            Gerrit-Change-Number: 235198
                            Gerrit-PatchSet: 9
                            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Reviewer: Emmanuel Odeke <emm....@gmail.com>
                            Gerrit-Reviewer: Gobot Gobot <go...@golang.org>
                            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                            Gerrit-CC: Liam Breck <networ...@gmail.com>
                            Gerrit-Comment-Date: Sat, 04 Jul 2020 06:30:22 +0000

                            Ian Lance Taylor (Gerrit)

                            unread,
                            Apr 21, 2021, 7:49:50 PM4/21/21
                            to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Go Bot, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Liam Breck, golang-co...@googlegroups.com

                            Attention is currently required from: Alex Brainman, Ibrahim Jarif, Emmanuel Odeke.

                            View Change

                            6 comments:

                            • Patchset:

                              • Patch Set #9:

                                Sorry for letting this sit. Let's try to get this into 1.17 if we can.

                                RELNOTES=yes

                            • File src/syscall/syscall_windows.go:

                              • Patch Set #2, Line 364:

                                	if mode&O_SYNC != 0 {
                                attrsAndFlags |= FILE_FLAG_WRITE_THROUGH
                                }

                                h, e := CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0)

                              • No, it won't compile. Thank you for catching it. […]

                                Done

                            • File src/syscall/syscall_windows.go:

                              • Patch Set #3, Line 351: h, e := CreateFile(pathp, access, sharemode, sa, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)

                              • Yeah, I missed that. I've added the flag on line 340 now.

                              • Done

                            • File src/syscall/syscall_windows.go:

                              • Done. Removed the new line.

                                Done

                            • File src/syscall/syscall_windows.go:

                              • Patch Set #9, Line 339: const _FILE_FLAG_WRITE_THROUGH uint32 = 0x80000000

                                No need to use a type here. Just remove the "uint32".

                              • Patch Set #9, Line 345: attrs = FILE_ATTRIBUTE_READONLY

                                This assignment is going to overwrite the WRITE_THROUGH flag.

                            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                            Gerrit-Project: go
                            Gerrit-Branch: master
                            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                            Gerrit-Change-Number: 235198
                            Gerrit-PatchSet: 9
                            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Reviewer: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Reviewer: Go Bot <go...@golang.org>
                            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                            Gerrit-CC: Liam Breck <networ...@gmail.com>
                            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Attention: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Attention: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Comment-Date: Wed, 21 Apr 2021 23:49:44 +0000
                            Gerrit-HasComments: Yes
                            Gerrit-Has-Labels: No
                            Comment-In-Reply-To: Alex Brainman <alex.b...@gmail.com>
                            Comment-In-Reply-To: Ibrahim Jarif <jarifi...@gmail.com>
                            Comment-In-Reply-To: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-MessageType: comment

                            Ian Lance Taylor (Gerrit)

                            unread,
                            Oct 11, 2021, 3:08:43 PM10/11/21
                            to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Go Bot, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Liam Breck, golang-co...@googlegroups.com

                            Attention is currently required from: Alex Brainman, Ibrahim Jarif, Emmanuel Odeke.

                            View Change

                            1 comment:

                            • Patchset:

                              • Patch Set #9:

                                There are still pending comments on this change. Any interest in addressing them? Thanks.

                            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                            Gerrit-Project: go
                            Gerrit-Branch: master
                            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                            Gerrit-Change-Number: 235198
                            Gerrit-PatchSet: 9
                            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Reviewer: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Reviewer: Go Bot <go...@golang.org>
                            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                            Gerrit-CC: Liam Breck <networ...@gmail.com>
                            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Attention: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Attention: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Comment-Date: Mon, 11 Oct 2021 19:08:39 +0000
                            Gerrit-HasComments: Yes
                            Gerrit-Has-Labels: No
                            Gerrit-MessageType: comment

                            Ibrahim Jarif (Gerrit)

                            unread,
                            Nov 15, 2021, 2:53:34 AM11/15/21
                            to Gerrit Bot, goph...@pubsubhelper.golang.org, Go Bot, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Ian Lance Taylor, Liam Breck, golang-co...@googlegroups.com

                            Attention is currently required from: Alex Brainman, Emmanuel Odeke.

                            View Change

                            1 comment:

                            • Patchset:

                              • Patch Set #9:

                                Hey! I won't be able to work on this CR. Please feel free to take over.
                                Apologies for being slow with replies.

                            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                            Gerrit-Project: go
                            Gerrit-Branch: master
                            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                            Gerrit-Change-Number: 235198
                            Gerrit-PatchSet: 9
                            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Reviewer: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Reviewer: Go Bot <go...@golang.org>
                            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                            Gerrit-CC: Liam Breck <networ...@gmail.com>
                            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Attention: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Comment-Date: Mon, 15 Nov 2021 07:53:28 +0000

                            Ian Lance Taylor (Gerrit)

                            unread,
                            Nov 16, 2021, 12:59:16 AM11/16/21
                            to Gerrit Bot, Ibrahim Jarif, goph...@pubsubhelper.golang.org, Go Bot, Emmanuel Odeke, Alex Brainman, Jason A. Donenfeld, Liam Breck, golang-co...@googlegroups.com

                            Ian Lance Taylor abandoned this change.

                            View Change

                            Abandoned Thanks. Needs to be taken over by someone else.

                            To view, visit change 235198. To unsubscribe, or for help writing mail filters, visit settings.

                            Gerrit-Project: go
                            Gerrit-Branch: master
                            Gerrit-Change-Id: If30258e19d9970ddc8a7174291f234a9cad4ac33
                            Gerrit-Change-Number: 235198
                            Gerrit-PatchSet: 9
                            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
                            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                            Gerrit-Reviewer: Emmanuel Odeke <emma...@orijtech.com>
                            Gerrit-Reviewer: Go Bot <go...@golang.org>
                            Gerrit-Reviewer: Ibrahim Jarif <jarifi...@gmail.com>
                            Gerrit-Reviewer: Jason A. Donenfeld <Ja...@zx2c4.com>
                            Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
                            Gerrit-CC: Liam Breck <networ...@gmail.com>
                            Gerrit-MessageType: abandon
                            Reply all
                            Reply to author
                            Forward
                            0 new messages