[go] windows: support app store symbolic links

136 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Feb 8, 2022, 2:19:03 PM2/8/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded this change for review.

View Change

windows: support app store symbolic links

`IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
installing an application via the Windows App Store. The location
of these links is added to the Windows PATH and the system can
resolve them. This adds support for these links so go can resolve them.

Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

To reproduce the current issue:

- Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
- The executable is added to your PATH and can be called from any terminal `python3 --version`
- Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
- Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
GitHub-Last-Rev: 494c30e18b55fa8995f85658b1a26df43189de7f
GitHub-Pull-Request: golang/go#51081
---
M src/internal/syscall/windows/reparse_windows.go
M src/os/file_windows.go
M src/syscall/types_windows.go
3 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/src/internal/syscall/windows/reparse_windows.go b/src/internal/syscall/windows/reparse_windows.go
index 6e11139..c5752fa 100644
--- a/src/internal/syscall/windows/reparse_windows.go
+++ b/src/internal/syscall/windows/reparse_windows.go
@@ -5,13 +5,16 @@
package windows

import (
+ "errors"
"syscall"
+ "unicode/utf16"
"unsafe"
)

const (
FSCTL_SET_REPARSE_POINT = 0x000900A4
IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
+ IO_REPARSE_TAG_APPEXECLINK = 0x8000001B

SYMLINK_FLAG_RELATIVE = 1
)
@@ -88,3 +91,40 @@
n2 := (rb.SubstituteNameOffset + rb.SubstituteNameLength) / 2
return syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(&rb.PathBuffer[0]))[n1:n2:n2])
}
+
+type GenericDataBuffer struct {
+ DataBuffer [1]uint8
+}
+
+type AppExecLinkReparseBuffer struct {
+ Version uint32
+ StringList [1]uint16
+}
+
+// Path returns path stored in rb
+// The buffer contains 4 null terminated strings inside
+// StringList. The third string contains the path to the
+// executable
+func (rb *AppExecLinkReparseBuffer) Path() (string, error) {
+ UTF16ToStringPosition := func(s []uint16) (string, int) {
+ for i, v := range s {
+ if v == 0 {
+ s = s[0:i]
+ return string(utf16.Decode(s)), i
+ }
+ }
+ return "", 0
+ }
+ stringList := (*[0xffff]uint16)(unsafe.Pointer(&rb.StringList[0]))[0:]
+ var link string
+ var position int
+ for i := 0; i <= 2; i++ {
+ link, position = UTF16ToStringPosition(stringList)
+ position++
+ if position >= len(stringList) {
+ return "", errors.New("invalid AppExecLinkReparseBuffer")
+ }
+ stringList = stringList[position:]
+ }
+ return link, nil
+}
diff --git a/src/os/file_windows.go b/src/os/file_windows.go
index 378e2b1..baa44fe 100644
--- a/src/os/file_windows.go
+++ b/src/os/file_windows.go
@@ -481,6 +481,17 @@
return normaliseLinkPath(s)
case windows.IO_REPARSE_TAG_MOUNT_POINT:
return normaliseLinkPath((*windows.MountPointReparseBuffer)(unsafe.Pointer(&rdb.DUMMYUNIONNAME)).Path())
+ case windows.IO_REPARSE_TAG_APPEXECLINK:
+ rb := (*windows.GenericDataBuffer)(unsafe.Pointer(&rdb.DUMMYUNIONNAME))
+ appExecLink := (*windows.AppExecLinkReparseBuffer)(unsafe.Pointer(&rb.DataBuffer))
+ if appExecLink.Version != 3 {
+ return " ", errors.New("unknown AppExecLink version")
+ }
+ s, err := appExecLink.Path()
+ if err != nil {
+ return "", err
+ }
+ return normaliseLinkPath(s)
default:
// the path is not a symlink or junction but another type of reparse
// point
diff --git a/src/syscall/types_windows.go b/src/syscall/types_windows.go
index 384b5b4..80ba89f 100644
--- a/src/syscall/types_windows.go
+++ b/src/syscall/types_windows.go
@@ -1163,6 +1163,7 @@
MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024
_IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
IO_REPARSE_TAG_SYMLINK = 0xA000000C
+
SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
_SYMLINK_FLAG_RELATIVE = 1
)

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

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
Gerrit-Change-Number: 384160
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-MessageType: newchange

Gopher Robot (Gerrit)

unread,
Feb 8, 2022, 2:19:49 PM2/8/22
to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

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

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#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 or adds a tag like "wait-release", it means that this CL will be
reviewed as part of the next development cycle. See https://go.dev/s/release
for more details.

View Change

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Tue, 08 Feb 2022 19:19:45 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Gerrit Bot (Gerrit)

    unread,
    Feb 8, 2022, 2:26:36 PM2/8/22
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Gerrit Bot uploaded patch set #2 to this change.

    View Change

    windows: support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 85fc2275788461d2abb6e226eda6ad78c8dec453

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/file_windows.go
    2 files changed, 78 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-MessageType: newpatchset

    Alex Brainman (Gerrit)

    unread,
    Apr 18, 2022, 3:29:49 AM4/18/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    7 comments:

    • Commit Message:

    • Patchset:

    • File src/internal/syscall/windows/reparse_windows.go:

      • Patch Set #2, Line 95: type GenericDataBuffer struct {

        I don't think you need to add this struct. See my comment in the code that uses GenericDataBuffer.

      • Patch Set #2, Line 99: type AppExecLinkReparseBuffer struct {

        Need some documentation references that describe this struct. Like URLs on line 23 and 24.

      • Patch Set #2, Line 105: // The buffer contains 4 null terminated strings inside

        How do you know this API is structured in this way? Need some references.

    • File src/os/file_windows.go:

      • Patch Set #2, Line 486: &rb.DataBuffer

        Why do you need to convert pointer into *windows.GenericDataBuffer first before converting it into *windows.AppExecLinkReparseBuffer?

        I think you can just convert it all in one line. Like this

        s/&rb.DataBuffer/&rdb.DUMMYUNIONNAME/

        . Isn't it?

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 18 Apr 2022 07:29:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Gerrit Bot (Gerrit)

    unread,
    Apr 18, 2022, 1:58:47 PM4/18/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #3 to this change.

    View Change

    windows: support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: ca2a55e7211394cd61324035efae035e27349303

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/file_windows.go
    2 files changed, 82 insertions(+), 1 deletion(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Gerrit Bot (Gerrit)

    unread,
    Apr 18, 2022, 2:50:50 PM4/18/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #4 to this change.

    View Change

    windows: support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: b0ec856f297a3634f87564ffb09b071f43a31025

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/file_windows.go
    2 files changed, 76 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 4

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 18, 2022, 4:14:08 PM4/18/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    5 comments:

    • Commit Message:

      • s/windows/os/ […]

        Done

      • Does this change fixes […]

        This change adds support for `os.Readlink()`, I'll see if I can find the code path to also support the issue in #42919 as that should be feasible.

        If you change the sample code to this, you can make it work (this doesn't work on the latest master):

        package main

        	import (
        "errors"
        "fmt"
        "os"
        "os/exec"
        )
        	func do() error {
        python := `C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`
        res, err := os.Lstat(python)
        if err != nil {
        return errors.New("python not found")
        }
        fmt.Println("python3 exists!")
        fmt.Printf("%#v\n", res)
        location, err := os.Readlink(python)
        if err != nil {
        return errors.New("python3 is not symlinked!")
        }
        cmd := exec.Command(location, "-c", "print('hello')")
        btes, err := cmd.CombinedOutput()
        if err != nil {
        return err
        }
        fmt.Printf("%s\n", string(btes))
        return nil
        }
        	func main() {
        err := do()
        if err != nil {
        panic(err)
        }
        }
    • File src/internal/syscall/windows/reparse_windows.go:

      • Need some documentation references that describe this struct. Like URLs on line 23 and 24.

      • Done

      • Patch Set #2, Line 105: // The buffer contains 4 null terminated strings inside

        How do you know this API is structured in this way? Need some references.

      • Done

    • File src/os/file_windows.go:

      • Why do you need to convert pointer into *windows. […]

        I see what you mean, but the rdb.DUMMYUNIONNAME field is a GenericDataBuffer struct that contains the DataBuffer which in this case is a AppExecLinkReparseBuffer. But looking at the MS docs, this can also be something else. So for future extensibility I also wanted to design it as such.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 2
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 18 Apr 2022 17:57:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Alex Brainman <alex.b...@gmail.com>
    Gerrit-MessageType: comment

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 19, 2022, 1:15:13 AM4/19/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/file_windows.go:

      • I see what you mean, but the rdb. […]

        I see what you mean now, changed.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 19 Apr 2022 05:15:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Alex Brainman (Gerrit)

    unread,
    Apr 19, 2022, 4:28:13 AM4/19/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Jan De Dobbeleer, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    5 comments:

    • Commit Message:

      • This change adds support for `os. […]

        Indeed.

        Please add

        Fixes #42919

        line here.

    • Patchset:

    • File src/internal/syscall/windows/reparse_windows.go:

      • Patch Set #4, Line 95:

        // these structs are described here:
        // https://stackoverflow.com/a/65583702
        // unfortunately, there's no official Microsoft documentation yet

        Replace lines 95-97 with this comment

        // AppExecLinkReparseBuffer is described at
        // https://stackoverflow.com/a/65583702
        // It appears there is no official Microsoft
        // documentation for AppExecLinkReparseBuffer yet.

        or similar.

        The comment should be proper English text - including capital letters and punctuation marks.

      • Patch Set #4, Line 107: func (rb *AppExecLinkReparseBuffer) Path() (string, error) {

        Your code looks too complicated. How about this instead

        ```
        func (rb *AppExecLinkReparseBuffer) Path() string {
        for j, from, i, p := 0, 0, 0, (*[1 << 24]uint16)(unsafe.Pointer(&rb.StringList[0])); true; i++ {
        if p[i] == 0 {
        // return 3rd string
        if j == 2 {
        return string(utf16.Decode(p[from:i]))
        }
        j++
        from = i + 1
        }
        }
        return ""
        }
        ```

        ?

        Copied from syscall.Environ.

        Here is playground link https://go.dev/play/p/b-S8ZEc1Hml in case you want to play with it.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 19 Apr 2022 08:28:07 +0000

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 19, 2022, 5:21:26 AM4/19/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    3 comments:

    • Commit Message:

      • Patch Set #2, Line 24:

        Indeed. […]

        I'm going to see if I can add support for exec.RunCommand directly first. As that should be possible, I just don't know yet why it can't resolve the link in that case.

    • File src/internal/syscall/windows/reparse_windows.go:

      • Replace lines 95-97 with this comment […]

        Done

      • Your code looks too complicated. How about this instead […]

        Done

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 4
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 19 Apr 2022 09:21:20 +0000

    Gerrit Bot (Gerrit)

    unread,
    Apr 19, 2022, 5:23:06 AM4/19/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #5 to this change.

    View Change

    os: support app store symbolic links


    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: cfd1baf17ef2277d7c9cbe941377da1fb6451156

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/file_windows.go
    2 files changed, 66 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 5
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Gerrit Bot (Gerrit)

    unread,
    Apr 19, 2022, 11:30:52 AM4/19/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #6 to this change.

    View Change

    os: support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 67a2506cd2d180543b4edc46f65219ec5747550b

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    3 files changed, 81 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 6

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 19, 2022, 11:33:15 AM4/19/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    2 comments:

    • Commit Message:

      • I'm going to see if I can add support for exec.RunCommand directly first. […]

        Done

    • File src/os/stat_windows.go:

      • Patch Set #6, Line 49: func resolveWindowsStoreApp(name string) string {

        While the fixes the linked issue, I would love to find another way (but have no idea how that could work). This makes os.stat and exec.Command work as intended.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 6
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 19 Apr 2022 15:33:09 +0000

    Gerrit Bot (Gerrit)

    unread,
    Apr 19, 2022, 3:14:08 PM4/19/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #7 to this change.

    View Change

    os: support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: f11bcbbf5a7fdd6350ac05f84ebd5508cc4811aa

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/exec/lp_windows.go
    M src/os/file_windows.go
    3 files changed, 70 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 7
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Gerrit Bot (Gerrit)

    unread,
    Apr 19, 2022, 3:22:17 PM4/19/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #8 to this change.

    View Change

    os: support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: aaf7044240a40d78d1fcddc085406e0ebb458547

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/exec/lp_windows.go
    M src/os/file_windows.go
    3 files changed, 69 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 19, 2022, 3:24:42 PM4/19/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/stat_windows.go:

      • While the fixes the linked issue, I would love to find another way (but have no idea how that could […]

        I found a clean way, it only needs to also still look for symbolic links in lookpath before deciding to call it quits.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 19 Apr 2022 19:24:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-MessageType: comment

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 19, 2022, 3:24:54 PM4/19/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

      • I don't think you need to add this struct. See my comment in the code that uses GenericDataBuffer.

      • Done

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 19 Apr 2022 19:24:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Sachin Joseph (Gerrit)

    unread,
    Apr 20, 2022, 12:08:51 PM4/20/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Patch set 8:Code-Review +1

    View Change

    1 comment:

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Wed, 20 Apr 2022 05:22:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Alex Brainman (Gerrit)

    unread,
    Apr 21, 2022, 11:29:17 PM4/21/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Patch set 8:Run-TryBot +1

    View Change

    4 comments:

    • Commit Message:

      • Patch Set #8, Line 7: os: support app store symbolic links

        s/os: support app store symbolic links/os: make Readlink support app store symbolic links/

        to have CL subject line reflect what this CL does.

    • Patchset:

      • Patch Set #8:

        Thanks for keeping up with me.

        Still couple more changes.

        Alex

    • File src/os/exec/lp_windows.go:

      • Patch Set #8, Line 51: if file, err := os.Readlink(file); err == nil {

        I don't see why changing this source file is required.

        None of other link types needed this change. Why are the app store symbolic links different?

    • File src/os/file_windows.go:


      • return " ", errors.New("unknown AppExecLink version")
        }

      • I think that check for correct version (lines 487-489) should be part of `appExecLink.Path` calculation. The check and the calculation are clearly related to each other.

        You should move lines 487-489 into `windows.AppExecLinkReparseBuffer.Path` method.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 22 Apr 2022 03:29:10 +0000

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 22, 2022, 2:29:49 AM4/22/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    3 comments:

    • Commit Message:

      • s/os: support app store symbolic links/os: make Readlink support app store symbolic links/ […]

        Done

    • File src/os/exec/lp_windows.go:

      • I don't see why changing this source file is required. […]

        They do not resolve, I don't know why that's the case, but this for sure doesn't work unless we explicitly try to resolve this. Otherwise it just returns file not found.

    • File src/os/file_windows.go:

      • I think that check for correct version (lines 487-489) should be part of `appExecLink. […]

        Done

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 22 Apr 2022 06:29:44 +0000

    Gerrit Bot (Gerrit)

    unread,
    Apr 22, 2022, 2:31:54 AM4/22/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #9 to this change.

    View Change

    os: make Readlink support app store symbolic links


    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 82a6a28a7bf661ade562c37df9c3983b972e1da0

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/exec/lp_windows.go
    M src/os/file_windows.go
    3 files changed, 69 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 9
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 22, 2022, 4:12:12 AM4/22/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/exec/lp_windows.go:

      • They do not resolve, I don't know why that's the case, but this for sure doesn't work unless we expl […]

        Unless we need to fix stat to actually return the right information as the right fix. If I get this correctly, it seems that stat should be able to resolve symbolic links and does so using CreateFile (which is a syscall) and that one fails on these type of links. So maybe addressing the issue there is the correct location as the will make stat and thus this work as well.

        https://github.com/JanDeDobbeleer/go/blob/2291cae2af659876e93a3e1f95c708abb1475d02/src/os/stat_windows.go#L46

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 22 Apr 2022 08:12:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Gerrit Bot (Gerrit)

    unread,
    Apr 22, 2022, 4:17:53 AM4/22/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #10 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 74bdeaac09d0aa602e9377d5d3115b5bfd34489d

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/os/exec/lp_windows.go
    M src/os/file_windows.go
    3 files changed, 70 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 10
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Gerrit Bot (Gerrit)

    unread,
    Apr 22, 2022, 4:31:10 AM4/22/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #11 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 521c9693402541882fadcfac1040e60914206110

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 81 insertions(+), 5 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 11

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 22, 2022, 4:42:31 AM4/22/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/exec/lp_windows.go:

      • Unless we need to fix stat to actually return the right information as the right fix. […]

        I found a better way, in this specific case CreateFile fails with ERROR_CANT_ACCESS_FILE and addressing it there will also make it so the entire sample code in https://github.com/golang/go/issues/42919 works as expected.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 11
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 22 Apr 2022 08:42:25 +0000

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 22, 2022, 5:02:34 AM4/22/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/exec/lp_windows.go:

      • I found a better way, in this specific case CreateFile fails with ERROR_CANT_ACCESS_FILE and address […]

        Alex, I have a question as the latest change implies a difference in behaviour. For these files, using os.Lstat(`C:\Users\jan\AppData\Local\Microsoft\WindowsApps\python3.exe`) will return an os.FileStat object pointing to C:\Users\jan\AppData\Local\Microsoft\WindowsApps\python3.exe. Using os.Stat(`C:\Users\jan\AppData\Local\Microsoft\WindowsApps\python3.exe`) however will follow the link and return an os.FileStat object pointing to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\python3.10.exe". I feel like it should be the other around BUT that will break the issue in #42919 as LookPath() uses os.Stat and not os.Lstat.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 11
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 22 Apr 2022 09:02:29 +0000

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 22, 2022, 5:04:03 AM4/22/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/exec/lp_windows.go:

      • Alex, I have a question as the latest change implies a difference in behaviour. […]

        Never mind, I misread. This is actually correct.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 11
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 22 Apr 2022 09:03:57 +0000

    Alex Brainman (Gerrit)

    unread,
    Apr 23, 2022, 4:03:32 AM4/23/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    6 comments:

    • Patchset:

    • File src/internal/syscall/windows/syscall_windows.go:

      • Patch Set #11, Line 46: ERROR_CANT_ACCESS_FILE

        We are not allowed to add new exported consts to syscall package. You have to use `internal/syscall/windows` package for that.

    • File src/os/stat_windows.go:

      • Patch Set #11, Line 93: // First use CreateFile.

        If you plan to also change os.Stat, then you should change all symlink related code. For example, grep for IO_REPARSE_TAG_SYMLINK and IO_REPARSE_TAG_MOUNT_POINT.

      • Patch Set #11, Line 96: defer syscall.CloseHandle(h)

        You did not consider scenario where err != nil and h is garbage. In that scenario syscall.CloseHandle parameter will be garbadge.

      • Patch Set #11, Line 102: if err == windows.ERROR_CANT_ACCESS_FILE {

        Maybe also check fa.FileAttributes to see if it is a symlink. We don't want every os.Stat user to call os.Reasdlink here before they will get error. That would be too expensive.

      • Patch Set #11, Line 105: stat

        Line 105 is part of `stat` function. Do you intend to call `stat` recursively?

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 11
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 23 Apr 2022 08:03:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Gerrit Bot (Gerrit)

    unread,
    Apr 23, 2022, 6:40:20 AM4/23/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #12 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 782602a34482d39aca5eb9842b893af990bb7471

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 80 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 12
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 23, 2022, 6:41:21 AM4/23/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    6 comments:

    • Patchset:

      • Patch Set #11:

        This is getting tricky. :-) […]

        I know :-) Otherwise someone would have solved this already.

    • File src/internal/syscall/windows/syscall_windows.go:

      • We are not allowed to add new exported consts to syscall package. […]

        this is in `internal/syscall/windows` unless I'm missing the point

    • File src/os/stat_windows.go:

      • If you plan to also change os.Stat, then you should change all symlink related code. […]

        I don't understand what you mean by this.

      • You did not consider scenario where err != nil and h is garbage. In that scenario syscall. […]

        Done

      • Maybe also check fa.FileAttributes to see if it is a symlink. We don't want every os. […]

        Done

      • Line 105 is part of `stat` function. […]

        I did. We need the actual path to then do stat again. But, looking at your previous remarks, only doing this in case of a symlink should not introduce an issue. The problem is that for regular symlinks, CreateFile does work. But not for these. So handling links by resolving the link is in my opinion the cleanest fix rather than rely on CreateFile do some magic.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 11
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 23 Apr 2022 10:41:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Gerrit Bot (Gerrit)

    unread,
    Apr 23, 2022, 6:44:12 AM4/23/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #13 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: a8678b1759bf639f294a77856f424a9035277fbc

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 79 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 13
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Gerrit Bot (Gerrit)

    unread,
    Apr 23, 2022, 7:37:19 AM4/23/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #14 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 608b935e4c12576c119f7ea7805f2ae86db43f26

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 77 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 14

    Gerrit Bot (Gerrit)

    unread,
    Apr 23, 2022, 7:41:06 AM4/23/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #15 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 9bed37863b23efd7751a2435a94b8558486659bf

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 80 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 15

    Gerrit Bot (Gerrit)

    unread,
    Apr 23, 2022, 10:38:34 AM4/23/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #16 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 576d33e98136503bb6e806ee639b31924b09a78e

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 80 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 16

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 23, 2022, 10:41:03 AM4/23/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/stat_windows.go:

      • Patch Set #11, Line 105: stat

        I did. We need the actual path to then do stat again. […]

        Found a solution that I feel is very acceptable, doesn't change the behaviour and simply works.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 12
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 23 Apr 2022 14:40:56 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Gerrit Bot (Gerrit)

    unread,
    Apr 23, 2022, 10:42:23 AM4/23/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #17 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 57b31bd0cb26d596bfe1fa6348751a1126b40022

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 80 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 17
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 23, 2022, 11:14:33 AM4/23/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/stat_windows.go:

      • Patch Set #11, Line 93: // First use CreateFile.

        I don't understand what you mean by this.

        I validated the existing functionality using a symlink I created that points to the same file. On master, this works for my symlink, but fails on the `IO_REPARSE_TAG_APPEXECLINK` symlink. I assume that's an issue in win32, as that should work imho the same, regardless. With this change, there's no difference in output for `Stat` for both, everything works as designed from an API perspective.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 16
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 23 Apr 2022 15:14:26 +0000

    Alex Brainman (Gerrit)

    unread,
    Apr 25, 2022, 4:13:35 AM4/25/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Jan De Dobbeleer, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Russ Cox.

    View Change

    3 comments:

    • File src/internal/syscall/windows/syscall_windows.go:

      • this is in `internal/syscall/windows` unless I'm missing the point

        I am mistakenly assumed you are using `syscall` package. Please ignore my comment.

    • File src/os/stat_windows.go:

      • I validated the existing functionality using a symlink I created that points to the same file. […]

        If you expect this change to fix all app link features, then we need new tests that verify everything - see `os.TestSymlink` for an example. Also you can add test that runs python.exe there too.

        It would be nice if we can create app link files on the fly and then delete them. If not, then add test that uses existing symlink. We can quietly skip the test, if the file is not present.

        I will use your new test manually here to verify your changes.

    • File src/os/stat_windows.go:

      • Patch Set #17, Line 110: defer syscall.CloseHandle(h)

        Restore original blank line between 110 and 111.

        IMHO the blank line helps to see that handle h allocated on line 99 is released on line 110.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 17
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 25 Apr 2022 08:13:29 +0000

    Jan De Dobbeleer (Gerrit)

    unread,
    Apr 30, 2022, 4:43:09 AM4/30/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    View Change

    2 comments:

    • File src/os/stat_windows.go:

      • If you expect this change to fix all app link features, then we need new tests that verify everythin […]

        Can I add an app link file to the `testdata` folder so there's an integration test (0 byte file anyways)? As I can't create a file on the fly (tried it, no avail).

    • File src/os/stat_windows.go:

      • Restore original blank line between 110 and 111. […]

        Done

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 17
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 30 Apr 2022 08:43:01 +0000

    Gerrit Bot (Gerrit)

    unread,
    Apr 30, 2022, 4:52:15 AM4/30/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    Gerrit Bot uploaded patch set #18 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 773195e152b77a2cdb3be1e9ddc8ddefb3423a19

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    4 files changed, 81 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 18
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Alex Brainman (Gerrit)

    unread,
    May 2, 2022, 6:16:20 AM5/2/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    View Change

    1 comment:

    • File src/os/stat_windows.go:

      • Can I add an app link file to the `testdata` folder so there's an integration test (0 byte file anyw […]

        I doubt you can create app link file in `testdata` that will be handled properly by git and on variety of OSes that Go supports (like Linux, MacOS, Plan 9 and others).

        Just hardcode whatever path that python executable uses. As long I (and others willing to install python for this exercise) can run your test, we are good enough.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 18
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 02 May 2022 10:16:12 +0000

    Gerrit Bot (Gerrit)

    unread,
    May 11, 2022, 5:13:28 AM5/11/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    Gerrit Bot uploaded patch set #19 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: ecd4cebafef79e576b5a1c070a06efb5db90fc97

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/stat_windows.go
    A src/os/stat_windows_test.go
    5 files changed, 113 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 19
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Jan De Dobbeleer (Gerrit)

    unread,
    Jul 28, 2022, 2:02:27 AM7/28/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    View Change

    1 comment:

    • File src/os/stat_windows.go:

      • I doubt you can create app link file in `testdata` that will be handled properly by git and on varie […]

        I did this, but forgot to ping you...

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 19
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Thu, 28 Jul 2022 06:02:20 +0000

    Alex Brainman (Gerrit)

    unread,
    Sep 11, 2022, 3:20:43 AM9/11/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    View Change

    11 comments:

    • Commit Message:

      • Patch Set #19, Line 3: AuthorDate: 2022-05-11 09:13:21 +0000

        Rebase your CL onto current master, so it is up to date.

      • Patch Set #19, Line 24:

        Add line that says

        Fixes #42919

        if this CL fixes the issue or

        Updates #42919

        if it fixes it, but not completely.

    • Patchset:

    • File src/os/stat_windows.go:

      • I did this, but forgot to ping you...

        No worries. Let's keep going.

    • File src/os/stat_windows.go:

      • Patch Set #19, Line 104: if err == windows.ERROR_CANT_ACCESS_FILE && reparsePoint != 0 {

        It is pointless to check reparsePoint value here. The only way for us to be on line 104 is if our file is reparse point. So revert your changes on lines 61-66.

    • File src/os/stat_windows_test.go:

      • Patch Set #19, Line 1: // Copyright 2022 The Go Authors. All rights reserved.

        Let's not create new test file (we already have too many). Let's put this short test into os_windows_test.go.

      • Patch Set #19, Line 12: "testing"

        I tried building your test and it fails to build:

        ```
        $ GOOS=windows go test -v -c -o ~/pub/test.exe os
        # os_test [os.test]
        os/stat_windows_test.go:8:2: imported and not used: "internal/testenv"
        os/stat_windows_test.go:9:2: imported and not used: "io/fs"
        os/stat_windows_test.go:11:2: imported and not used: "runtime"
        os/stat_windows_test.go:18:30: undefined: os
        os/stat_windows_test.go:19:14: undefined: Lstat
        os/stat_windows_test.go:25:13: undefined: Stat
        $
        ```

      • Patch Set #19, Line 17: pythonVersion

        s/pythonVersion/pythonExeName/

        because pythonVersion is confusing for me. Pick different name, if you don't like my suggestion.

      • Patch Set #19, Line 23: return

        Replace return with

        t.Skip("skipping test, because Python 3 is not installed via the Windows App Store on this system; see https://golang.org/issue/42919")

        and then you will not even need comments above.

        Unlike return, t.Skip will at least display a warning if user runs your test with -v flag.

      • Patch Set #19, Line 30: res

        s/res/res.Name()/

        No?

      • Patch Set #19, Line 30: %s != %s

        s/%s != %s/got %q, but wanted %q/

        for clearer error message

        and %q to have file name quoted in case there is a space in the name.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 19
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 11 Sep 2022 07:20:37 +0000

    Gerrit Bot (Gerrit)

    unread,
    Sep 27, 2022, 2:38:47 PM9/27/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    Gerrit Bot uploaded patch set #20 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: ee93d0f497bc192106dc6087d0247b816add6a0e

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/os_windows_test.go
    M src/os/stat_windows.go
    5 files changed, 97 insertions(+), 2 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 20
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Gerrit Bot (Gerrit)

    unread,
    Sep 27, 2022, 2:54:24 PM9/27/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    Gerrit Bot uploaded patch set #21 to this change.

    View Change

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 170fa14bce86e3f3ef4d080093acb2ff1e8e6b15

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/os_windows_test.go
    M src/os/stat_windows.go
    5 files changed, 91 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21

    Alex Brainman (Gerrit)

    unread,
    Oct 8, 2022, 3:26:37 AM10/8/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    Patch set 21:Run-TryBot +1

    View Change

    1 comment:

    • Patchset:

      • Patch Set #21:

        Hello Jan,

        You did not send your replies to me questions again.

        But it appears you made changes I requested.

        I will run try-bots. And then I will try your change on my laptop.

        Alex

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 08 Oct 2022 07:26:30 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Alex Brainman (Gerrit)

    unread,
    Oct 8, 2022, 4:38:51 AM10/8/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    View Change

    1 comment:

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 08 Oct 2022 08:38:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 8, 2022, 6:18:02 AM10/8/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    View Change

    9 comments:

    • Commit Message:

      • Patch Set #19, Line 3: AuthorDate: 2022-05-11 09:13:21 +0000

        Rebase your CL onto current master, so it is up to date.

      • Done

      • Add line that says […]

        This is already in the commit message

    • File src/os/stat_windows.go:

      • It is pointless to check reparsePoint value here. […]

        Done

    • File src/os/stat_windows_test.go:

      • Let's not create new test file (we already have too many). […]

        Done

      • I tried building your test and it fails to build: […]

        Done

      • s/pythonVersion/pythonExeName/ […]

        Done

      • Replace return with […]

        Done

      • s/res/res.Name()/ […]

        Done

      • s/%s != %s/got %q, but wanted %q/ […]

        Done

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 08 Oct 2022 10:17:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 8, 2022, 6:18:54 AM10/8/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #21:

        LGTM after you address this […]

        I forgot to press reply so my comment wasn't yet pushed. I added that statement to the commit message, this isn't updated in the description here.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 08 Oct 2022 10:18:46 +0000

    Alex Brainman (Gerrit)

    unread,
    Oct 8, 2022, 10:11:32 PM10/8/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Robert Griesemer, Russ Cox.

    Patch set 21:Auto-Submit +1Code-Review +2

    View Change

    2 comments:

    • Patchset:

      • Patch Set #21:

        I still don't see Gerrit commit message changed.

        I can see you changed commit message on Github. But your Github PR message does not include issue references number in it.

        I suspect Go bot that copies Github changes into Gerrit uses PR message and ignores commit messages.

        See

        https://go.dev/doc/contribute#sending_a_change_github

        ... and the final commit description will be composed by concatenating the pull request's title and description. The individual commits' descriptions will be discarded. ...

      • Patch Set #21:

        I still don't see CL message changed - see below.

        But LGTM anyway.

        I will mark this CL +2 and auto-submit. Then, once 2 Googlers give this CL +1, it will get automatically submitted. This URL

        https://go.dev/s/needs-review

        is what they use to monitor CLs that needs their +1s. Hopefully your CL will be there.

        Please update CL message anyway. Hopefully you will update it before CL gets submitted.

        Thank you.

        Alex

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 09 Oct 2022 02:11:25 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 9, 2022, 2:12:45 AM10/9/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    View Change

    2 comments:

    • Patchset:

      • Patch Set #21:

        I still don't see CL message changed - see below. […]

        I adjusted it at GitHub, seems to have flown through.

      • I adjusted it at GitHub, seems to have flown through.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 21
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 09 Oct 2022 06:12:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Gerrit Bot (Gerrit)

    unread,
    Oct 9, 2022, 2:13:05 AM10/9/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    Gerrit Bot uploaded patch set #22 to this change.

    View Change

    The following approvals got outdated and were removed: Auto-Submit+1 by Alex Brainman

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Fixes #42919


    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 170fa14bce86e3f3ef4d080093acb2ff1e8e6b15
    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/reparse_windows.go
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/file_windows.go
    M src/os/os_windows_test.go
    M src/os/stat_windows.go
    5 files changed, 93 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Bryan Mills (Gerrit)

    unread,
    Oct 10, 2022, 12:16:56 PM10/10/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, Robert Griesemer, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Robert Griesemer, Russ Cox.

    View Change

    1 comment:

    • File src/internal/syscall/windows/reparse_windows.go:

      • Patch Set #22, Line 112: (*[1 << 24]uint16)(unsafe.Pointer(&rb.StringList[0]))

        This pointer conversion seems likely to blow up under `-d=checkptr` (compare #38355, #34972).

        Instead, use a pointer-increment loop like the one in `windows.UTF16PtrToString`.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Bryan Mills <bcm...@google.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Robert Griesemer <g...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 10 Oct 2022 16:16:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Bryan Mills (Gerrit)

    unread,
    Oct 10, 2022, 12:18:10 PM10/10/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Robert Griesemer, Bryan Mills, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Russ Cox.

    Bryan Mills removed Robert Griesemer from this change.

    View Change

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: deleteReviewer

    Alex Brainman (Gerrit)

    unread,
    Oct 15, 2022, 5:41:33 PM10/15/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    Patch set 22:Run-TryBot +1Code-Review +2

    View Change

    1 comment:

    • File src/internal/syscall/windows/reparse_windows.go:

      • This pointer conversion seems likely to blow up under `-d=checkptr` (compare #38355, #34972). […]

        Good catch Bryan.

        Jan, let me know, if you need help with that.

        Alex

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 15 Oct 2022 21:41:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Bryan Mills <bcm...@google.com>
    Gerrit-MessageType: comment

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 15, 2022, 6:22:29 PM10/15/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/internal/syscall/windows/reparse_windows.go:

      • Good catch Bryan. […]

        I'm going to try to give this a go but I have to be honest, my pointer skill game here is low.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sat, 15 Oct 2022 22:22:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Bryan Mills <bcm...@google.com>

    Alex Brainman (Gerrit)

    unread,
    Oct 15, 2022, 8:01:28 PM10/15/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox.

    View Change

    1 comment:

    • File src/internal/syscall/windows/reparse_windows.go:

      • I'm going to try to give this a go but I have to be honest, my pointer skill game here is low.

        You might be able to trigger that crash during your test if you do this

        ```
        go test -gcflags=all=-d=checkptr ...
        ```

        Also see

        https://go-review.googlesource.com/c/go/+/208617

        for context.

        Alex

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 16 Oct 2022 00:01:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 18, 2022, 3:55:00 AM10/18/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/internal/syscall/windows/reparse_windows.go:

      • You might be able to trigger that crash during your test if you do this […]

        So, it turns out we don't need to parse this link format. I was finally able to debug the latest changes (changed laptop to ARM in the meantime and debugging with delve was broken). I used the same code snippet as in #42919 and it all works as designed by only doing the fallback to opening the symbolic link. @alex.b...@gmail.com can you validate on your end as well?

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 18 Oct 2022 07:54:53 +0000

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 18, 2022, 3:57:19 AM10/18/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/internal/syscall/windows/reparse_windows.go:

      • So, it turns out we don't need to parse this link format. […]

        Done

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 22
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 18 Oct 2022 07:57:12 +0000

    Gerrit Bot (Gerrit)

    unread,
    Oct 18, 2022, 3:57:31 AM10/18/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #23 to this change.

    View Change

    The following approvals got outdated and were removed: Run-TryBot+1 by Alex Brainman, TryBot-Result+1 by Gopher Robot

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Fixes #42919

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: ff0eb0ce063f33bd97324db9ecfe3d8ba763f5f4
    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/os_windows_test.go
    M src/os/stat_windows.go
    3 files changed, 53 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 23
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Alex Brainman (Gerrit)

    unread,
    Oct 22, 2022, 9:16:32 PM10/22/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox.

    Patch set 23:Code-Review +2

    View Change

    2 comments:

    • Patchset:

    • File src/internal/syscall/windows/reparse_windows.go:

      • Done

        I just run TestAppLinkSymlinkStat on top of your patchset 22. And the test still PASSes.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 23
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 23 Oct 2022 01:16:25 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Alex Brainman (Gerrit)

    unread,
    Oct 22, 2022, 9:20:30 PM10/22/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox.

    View Change

    1 comment:

    • Patchset:

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 23
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 23 Oct 2022 01:20:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Bryan Mills (Gerrit)

    unread,
    Oct 24, 2022, 12:34:23 PM10/24/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Alex Brainman, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox.

    Patch set 23:Run-TryBot +1

    View Change

    4 comments:

    • Patchset:

      • Patch Set #23:

        Bryan, […]

        To show up on `needs-review` it also needs a TryBot +1 on the current patchset.

      • Patch Set #23:

        TRY=windows-amd64-longtest

    • File src/os/stat_windows.go:

      • Patch Set #23, Line 98: // In this case we need to open the link and continue with the right handle.

        How do we know that `ERROR_CANT_ACCESS_FILE` necessarily implies an app executable file here? (Or, why would `openSymlink` be appropriate to try for other cases?)

        Also, why don't these links end up in the `FILE_ATTRIBUTE_REPARSE_POINT` case at line 62? (A bit more detail in the comment would be helpful.)

      • Patch Set #23, Line 101: h, err = openSymlink(name)

        If `openSymlink` fails, we'll still report the error as a `CreateFile` error at line 104. `openSymlink` does use `CreateFile` today, but that isn't locally obvious — I think we should either restore the original error if `openSymlink` fails, or have `openSymlink` itself return a `PathError` that we can return directly here.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 23
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 24 Oct 2022 16:34:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 24, 2022, 12:55:05 PM10/24/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    View Change

    2 comments:

    • File src/os/stat_windows.go:

      • How do we know that `ERROR_CANT_ACCESS_FILE` necessarily implies an app executable file here? (Or, w […]

        Good question, I'll have to debug this again to add that context. Will do.

      • If `openSymlink` fails, we'll still report the error as a `CreateFile` error at line 104. […]

        Will have a look.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 23
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 24 Oct 2022 16:54:56 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Gerrit Bot (Gerrit)

    unread,
    Oct 25, 2022, 5:12:32 AM10/25/22
    to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    Gerrit Bot uploaded patch set #24 to this change.

    View Change

    The following approvals got outdated and were removed: Run-TryBot+1 by Bryan Mills, TryBot-Result+1 by Gopher Robot

    os: make Readlink support app store symbolic links

    `IO_REPARSE_TAG_APPEXECLINK` are types of links that are created when
    installing an application via the Windows App Store. The location
    of these links is added to the Windows PATH and the system can
    resolve them. This adds support for these links so go can resolve them.

    Fixes #42919

    Illustrated to work in [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh/pull/1719/commits/7618dc6cbd00c0a79924e0286b821aa50c46dc74) and confirmed by end-users.

    To reproduce the current issue:

    - Install a Windows Store App like [Python3.10](https://www.microsoft.com/store/productId/9PJPW5LDXLZ5)
    - The executable is added to your PATH and can be called from any terminal `python3 --version`
    - Resolving the executable in PowerShell points to `$Env:LOCALAPPDATA/Microsoft/WindowsApps/python3.exe` which is a symbolic link
    - Trying to resolve the symbolic link in golang 1.17 results in an error as `IO_REPARSE_TAG_APPEXECLINK` isn't supported: `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3`)`

    With this change `IO_REPARSE_TAG_APPEXECLINK` is now supported and `os.Readlink(`C:/Users/jan/AppData/Local/Microsoft/WindowsApps/python3.exe`)` returns the actual path to the executable.

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 885f12abd1f602ce400c3ec153d57997bc72e478

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/os_windows_test.go
    M src/os/stat_windows.go
    3 files changed, 60 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 24
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-MessageType: newpatchset

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 25, 2022, 5:41:09 AM10/25/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    View Change

    2 comments:

    • File src/os/stat_windows.go:

      • Good question, I'll have to debug this again to add that context. Will do.

        I validated all known use-cases here. Line 62 rightfully doesn't match as this is a symbolic link just like a regular one. No errors and the correct file attributes. The only difference is that for `APPEXECLINKS`, `Createfile` fails to open them (one could see that as a win32 bug). Non-existing files fail with a different error so this path is only hit in that use-case as regular files do fall within the line 62 block.

      • Will have a look.

        Made sure to also simply use `CreateFile` here as there's no gain in using `openSymlink` directly. This was we preserve the context.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 24
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Tue, 25 Oct 2022 09:41:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Alex Brainman (Gerrit)

    unread,
    Oct 30, 2022, 3:05:10 AM10/30/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    Patch set 24:-Code-Review

    View Change

    3 comments:

    • Patchset:

      • Patch Set #24:

        I discovered problem with your change. See my comments below.

        Thank you.

        Alex

    • File src/os/os_windows_test.go:

      • Patch Set #24, Line 1258: }

        You ignore check for os.Lstat result. If you add check like this one:


        ```
        if res.Name() != pythonPath {
        t.Fatalf("Lstat %s: got %q, but wanted %q", pythonPath, res.Name(), pythonPath)
        }
        ```

        you will see that your test fails.

    • File src/os/stat_windows.go:

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 24
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 30 Oct 2022 07:05:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Jan De Dobbeleer (Gerrit)

    unread,
    Oct 30, 2022, 4:39:21 AM10/30/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox.

    View Change

    2 comments:

    • File src/os/os_windows_test.go:

      • You ignore check for os.Lstat result. If you add check like this one: […]

        When I call the following, I get `python3.exe` as `res.Name()` which is correct, no? It would never return the full path like `pythonPath`, just the file name.

        ```python
        exe := `C:\Users\jan\AppData\Local\Microsoft\WindowsApps\python3.exe`
        res, err := os.Lstat(exe)
        ```

    • File src/os/stat_windows.go:

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 24
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Sun, 30 Oct 2022 08:39:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No

    Alex Brainman (Gerrit)

    unread,
    Nov 21, 2022, 3:12:36 AM11/21/22
    to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox.

    View Change

    1 comment:

    • File src/os/os_windows_test.go:

      • When I call the following, I get `python3.exe` as `res. […]

        Yes. You are correct that res.Name() should be set to "python3.exe", not to "C:\Users\jan\AppData\Local\Microsoft\WindowsApps\python3.exe".

        I got confused reviewing your CL. I don't concentrate on your CL for long enough. So I decided to spent some time on this issue. And I came up with slightly different solution - https://go-review.googlesource.com/c/go/+/452375 . But my solution is based on all the work and discovery that you did here.

        If you are happy with https://go-review.googlesource.com/c/go/+/452375, I urge you to copy the code and CL message into your CL. And then I will approve it and we will finally submit this.

        Thank you.

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 24
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Mon, 21 Nov 2022 08:12:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

    Jan De Dobbeleer (Gerrit)

    unread,
    Nov 25, 2022, 7:42:17 AM11/25/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Alex Brainman, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Russ Cox.

    View Change

    1 comment:

    • File src/os/os_windows_test.go:

      • Yes. You are correct that res.Name() should be set to "python3. […]

        done!

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 24
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 25 Nov 2022 12:42:09 +0000

    Gerrit Bot (Gerrit)

    unread,
    Nov 25, 2022, 7:42:33 AM11/25/22
    to Alex Brainman, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

    Gerrit Bot uploaded patch set #25 to this change.

    View Change

    os: add support for AppExecLinks

    This change adds support for AppExecLinks files, like

    C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe

    The python3.exe can be installed by following these

    https://www.microsoft.com/store/productId/9PJPW5LDXLZ5

    instructions. The executable is added to your PATH and can be called
    from command line, like `python3 --version`.

    Calling GetFileAttributesEx on python3.exe returns FileAttributes with
    FILE_ATTRIBUTE_REPARSE_POINT set. And os.Stat attempts to follow the
    link. But Microsoft does not provide any link target for AppExecLinks
    files (see
    https://github.com/dotnet/runtime/pull/58233#issuecomment-911971904 ),
    and Go should treat AppExecLinks as normal files and not symlinks.

    This CL adjusts os.Stat implementation to return normal file
    os.FileInfo
    for AppExecLinks files instead of symlinks. The AppExecLinks files are
    recognised as they return ERROR_CANT_ACCESS_FILE from CreateFile call.
    The trick is not documented anywhere. Jan De Dobbeleer discovered the
    trick. Also https://github.com/dotnet/runtime/pull/58233 appears to
    also
    use ERROR_CANT_ACCESS_FILE to distinguish AppExecLinks files.

    The CL also adds new tests.

    The CL is an extended copy of the Jan De Dobbeleer
    https://go-review.googlesource.com/c/go/+/384160 CL.

    Fixes #42919

    Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    GitHub-Last-Rev: 48f6c1d489a038983f4f4e90040d5cb921110604

    GitHub-Pull-Request: golang/go#51081
    ---
    M src/internal/syscall/windows/syscall_windows.go
    M src/os/os_windows_test.go
    M src/os/stat_windows.go
    M src/os/types_windows.go
    4 files changed, 122 insertions(+), 0 deletions(-)

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 25
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Alex Brainman <alex.b...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>

    Alex Brainman (Gerrit)

    unread,
    Nov 25, 2022, 4:31:21 PM11/25/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

    View Change

    1 comment:

    • File src/os/os_windows_test.go:

      • done!

        Well done.

        Let's continue with your CL.

        I will give your CL +2. But we have to wait for Go source tree to open for Go 1.21 development to submit this.

        You don't have to do anything unless other reviews.

        Thank you.

        Alex

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

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
    Gerrit-Change-Number: 384160
    Gerrit-PatchSet: 25
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Russ Cox <r...@golang.org>
    Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
    Gerrit-CC: Alex Brainman <alex.b...@gmail.com>
    Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
    Gerrit-Attention: Russ Cox <r...@golang.org>
    Gerrit-Comment-Date: Fri, 25 Nov 2022 21:31:13 +0000

    Alex Brainman (Gerrit)

    unread,
    Nov 25, 2022, 4:31:58 PM11/25/22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

    Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

    Patch set 25:Run-TryBot +1Code-Review +2

    View Change

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

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
      Gerrit-Change-Number: 384160
      Gerrit-PatchSet: 25
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
      Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-Attention: Bryan Mills <bcm...@google.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Fri, 25 Nov 2022 21:31:51 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      Gerrit-MessageType: comment

      Quim Muntal (Gerrit)

      unread,
      Nov 27, 2022, 1:36:07 PM11/27/22
      to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

      Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

      View Change

      1 comment:

      • File src/os/os_windows_test.go:

        • Patch Set #25, Line 1322: output, err := cmd.CombinedOutput()

          This call will fail if python3.exe is not installed but the reparse point exists.

          The error code is 90009 and the message looks like:
          > "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.\r\n"

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

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
      Gerrit-Change-Number: 384160
      Gerrit-PatchSet: 25
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
      Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-CC: Quim Muntal <quimm...@gmail.com>
      Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-Attention: Bryan Mills <bcm...@google.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Sun, 27 Nov 2022 18:36:00 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Quim Muntal (Gerrit)

      unread,
      Nov 27, 2022, 1:43:26 PM11/27/22
      to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

      Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

      View Change

      1 comment:

      • File src/os/os_windows_test.go:

        • Patch Set #25, Line 1322: output, err := cmd.CombinedOutput()

          This call will fail if python3.exe is not installed but the reparse point exists. […]

        • The test should be skipped if thid case is detected.

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

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
      Gerrit-Change-Number: 384160
      Gerrit-PatchSet: 25
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
      Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-CC: Quim Muntal <quimm...@gmail.com>
      Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-Attention: Bryan Mills <bcm...@google.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Sun, 27 Nov 2022 18:43:19 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Quim Muntal <quimm...@gmail.com>
      Gerrit-MessageType: comment

      Bryan Mills (Gerrit)

      unread,
      Nov 28, 2022, 10:51:10 AM11/28/22
      to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Bryan Mills, Quim Muntal, Gopher Robot, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

      Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

      Patch set 25:Hold +1

      View Change

      6 comments:

      • Patchset:

        • Patch Set #25:

          Setting Hold+1 until the tree reopens for Go 1.21.

          I also re-reviewed the code (since a lot has changed since I last reviewed it at PatchSet 22) and added a few (minor) comments.

      • File src/os/os_windows_test.go:

        • Patch Set #25, Line 1296:

          		t.Logf("lfi=%+v", lfi)
          t.Logf("sfi=%+v", sfi)

          (https://go.dev/wiki/CodeReviewComments#useful-test-failures)

          A reader of the test log won't know what `lfi` and `sfi` are here.
          Either log that information too, or update the `Logf` lines here to be independent of the variable names.

          Perhaps:
          ```
          t.Logf("os.Lstat(%q) = %+v", pythonPath, lfi)
          t.Logf("os.Stat(%q) = %+v", pythonPath, sfi)
          ```

        • Patch Set #25, Line 1298: t.Errorf("files should be same")

          More detail in this failure message and/or a comment in the code would be helpful.

          (*Why* do we expect these to be the same file? How do we know that `pythonPath` isn't an ordinary symlink?)

          Perhaps the `SameFile` check should go after the individual `Mode()` checks, so that the `Mode` output may explain a later `SameFile` failure.

        • Patch Set #25, Line 1304: if m := lfi.Mode(); m&fs.ModeSymlink != 0 {

          A comment here would be helpful: how do we know that `pythonPath` will not be a symlink?

      • File src/os/stat_windows.go:

        • Validated again and added a comment.

          Is there anything remaining to be done for this? (If not, please mark the comment thread as resolved.)

      • File src/os/stat_windows.go:

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

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
      Gerrit-Change-Number: 384160
      Gerrit-PatchSet: 25
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
      Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-CC: Quim Muntal <quimm...@gmail.com>
      Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
      Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Mon, 28 Nov 2022 15:51:05 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes

      Bryan Mills (Gerrit)

      unread,
      Nov 28, 2022, 10:51:25 AM11/28/22
      to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Bryan Mills, Quim Muntal, Gopher Robot, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

      Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

      Patch set 25:Code-Review +1

      View Change

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 25
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Mon, 28 Nov 2022 15:51:21 +0000

        Jan De Dobbeleer (Gerrit)

        unread,
        Dec 11, 2022, 4:01:47 AM12/11/22
        to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Bryan Mills, Quim Muntal, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        View Change

        5 comments:

        • File src/os/os_windows_test.go:

          • More detail in this failure message and/or a comment in the code would be helpful. […]

            Done

          • Patch Set #25, Line 1304: if m := lfi.Mode(); m&fs.ModeSymlink != 0 {

            A comment here would be helpful: how do we know that `pythonPath` will not be a symlink?

          • Done

        • File src/os/stat_windows.go:

          • Is there anything remaining to be done for this? (If not, please mark the comment thread as resolved […]

            Done

        • File src/os/stat_windows.go:

          • We can't guarantee that this external link will always be valid or accessible. […]

            Done

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 25
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Sun, 11 Dec 2022 09:01:37 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>

        Gerrit Bot (Gerrit)

        unread,
        Dec 11, 2022, 4:03:27 AM12/11/22
        to Alex Brainman, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        Gerrit Bot uploaded patch set #26 to this change.

        View Change

        The following approvals got outdated and were removed: Run-TryBot+1 by Alex Brainman, TryBot-Result+1 by Gopher Robot

        os: add support for AppExecLinks
        GitHub-Last-Rev: 1b731b3e5f1419657ef6b001873fbd077334172e

        GitHub-Pull-Request: golang/go#51081
        ---
        M src/internal/syscall/windows/syscall_windows.go
        M src/os/os_windows_test.go
        M src/os/stat_windows.go
        M src/os/types_windows.go
        4 files changed, 131 insertions(+), 0 deletions(-)

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 26
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Alex Brainman <alex.b...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-MessageType: newpatchset

        Bryan Mills (Gerrit)

        unread,
        Dec 12, 2022, 2:23:59 PM12/12/22
        to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Bryan Mills, Quim Muntal, Gopher Robot, Sachin Joseph, Jan De Dobbeleer, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        Patch set 26:Code-Review +1Hold +1

        View Change

        6 comments:

        • File src/os/os_windows_test.go:

        • File src/os/stat_windows.go:

          • Patch Set #26, Line 72: We must be dealing with APPEXECLINK

            How do we know that only APPEXECLINK reparse points will trigger `ERROR_CANT_ACCESS_FILE`?

            Can other kinds of reparse points also trigger it? If so, that seems fine, but the code comment would be misleading.

            What about if `GetFileAttributeEx` returned a non-nil error? Then it seems like we don't even know whether the path refers to a reparse point...

          • Patch Set #26, Line 81: fa

            How do we know that `fa` is valid here?

            (What happens if `GetFileAttributeEx` returns a non-nil error other than `ERROR_SHARING_VIOLATION` and `CreateFile` returns `ERROR_CANT_ACCESS_FILE`?)

        • File src/os/types_windows.go:

          • Patch Set #26, Line 174: We must be dealing with APPEXECLINK,

            How do we know that only an `APPEXECLINK` can trigger this error?

            • Might it also apply to other reparse points?
            • If the call to `CreateFile` with `FILE_FLAG_OPEN_REPARSE_POINT` set also fails, should we return the error from the original `CreateFile` call, or the one with `FILE_FLAG_OPEN_REPARSE_POINT` set? (A code comment with a rationale would be helpful.)
          • Patch Set #26, Line 177: attrs |= syscall.FILE_FLAG_OPEN_REPARSE_POINT

            It looks like `FILE_FLAG_OPEN_REPARSE_POINT` is already set if `fs.isSymlink()` is true — should we avoid repeating the call in that case?

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 26
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Alex Brainman <alex.b...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Mon, 12 Dec 2022 19:23:52 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Gerrit-MessageType: comment

        Jan De Dobbeleer (Gerrit)

        unread,
        Dec 13, 2022, 2:40:25 PM12/13/22
        to Gerrit Bot, Alex Brainman, goph...@pubsubhelper.golang.org, Bryan Mills, Quim Muntal, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        View Change

        6 comments:

        • File src/os/os_windows_test.go:

          • Done

          • Done

        • File src/os/stat_windows.go:

          • How do we know that only APPEXECLINK reparse points will trigger `ERROR_CANT_ACCESS_FILE`? […]

            Added that validation and created an explicit check

          • How do we know that `fa` is valid here? […]

            Done

        • File src/os/types_windows.go:

          • How do we know that only an `APPEXECLINK` can trigger this error? […]

            This code was added by @alex.b...@gmail.com and as these do not identify as a symlink, we need to add that explicitly. `fs.isSymlink()` is false here.

          • It looks like `FILE_FLAG_OPEN_REPARSE_POINT` is already set if `fs. […]

            This code was added by @alex.b...@gmail.com and as these do not identify as a symlink, we need to add that explicitly. `fs.isSymlink()` is false here.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 26
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Alex Brainman <alex.b...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Tue, 13 Dec 2022 19:40:18 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>
        Gerrit-MessageType: comment

        Gerrit Bot (Gerrit)

        unread,
        Dec 13, 2022, 2:40:52 PM12/13/22
        to Alex Brainman, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        Gerrit Bot uploaded patch set #27 to this change.

        View Change

        os: add support for AppExecLinks
        GitHub-Last-Rev: f171935f26833aa6ba0ace048f29f53934546836
        GitHub-Pull-Request: golang/go#51081
        ---
        M src/internal/syscall/windows/reparse_windows.go
        M src/internal/syscall/windows/syscall_windows.go
        M src/os/file_windows.go

        M src/os/os_windows_test.go
        M src/os/stat_windows.go
        M src/os/types_windows.go
        6 files changed, 155 insertions(+), 6 deletions(-)

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 27
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Alex Brainman <alex.b...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-MessageType: newpatchset

        Gerrit Bot (Gerrit)

        unread,
        Dec 16, 2022, 4:05:38 AM12/16/22
        to Alex Brainman, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        Gerrit Bot uploaded patch set #28 to this change.

        View Change

        GitHub-Last-Rev: a2c95ef9f681914bab54aaa22230f060961152ce

        GitHub-Pull-Request: golang/go#51081
        ---
        M src/internal/syscall/windows/reparse_windows.go
        M src/internal/syscall/windows/syscall_windows.go
        M src/os/file_windows.go
        M src/os/os_windows_test.go
        M src/os/stat_windows.go
        M src/os/types_windows.go
        6 files changed, 174 insertions(+), 6 deletions(-)

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 28

        Gerrit Bot (Gerrit)

        unread,
        Dec 16, 2022, 5:09:42 AM12/16/22
        to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        Gerrit Bot uploaded patch set #29 to this change.

        View Change

        GitHub-Last-Rev: f5543ee2d24ea02cb10d2bc7e8926ad1060119db

        GitHub-Pull-Request: golang/go#51081
        ---
        M src/internal/syscall/windows/reparse_windows.go
        M src/internal/syscall/windows/syscall_windows.go
        M src/os/file_windows.go
        M src/os/os_windows_test.go
        M src/os/stat_windows.go
        M src/os/types_windows.go
        6 files changed, 174 insertions(+), 6 deletions(-)

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 29

        Alex Brainman (Gerrit)

        unread,
        Dec 24, 2022, 9:18:52 PM12/24/22
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Bryan Mills, Quim Muntal, Gopher Robot, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

        Patch set 29:Run-TryBot +1Code-Review +2

        View Change

        7 comments:

        • Patchset:

          • Patch Set #29:

            Thank you everyone for pushing this along. See my comments below.

            Jan, your new test fails on my laptop. So, please, fix it. And then I review your changes since Patch Set 25. I suggest you remove as much changes as you made since that Patch Set.

            Thank you.

            Alex

        • File src/os/os_windows_test.go:

          • Patch Set #25, Line 1322: output, err := cmd.CombinedOutput()

            The test should be skipped if thid case is detected.

            We already skip this test if os.Lstat("C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe") fails. See line 1287.

            I tested that skip when I had no python installed on my laptop. The skip is also tested by every Go Team builder run (I suspect there is no python appexeclink installed there).

            How do we test scenario where you see error code of 90009? Is that the same as what I had before installing python?

        • File src/os/os_windows_test.go:

          • Patch Set #29, Line 1336: func TestAppExecLinkReadlink(t *testing.T) {

            Is it possible to join this test with TestAppExecLinkStat ? So we have less tests to look at. And less code in the test.

          • Patch Set #29, Line 1346: If it does, we should update our implementation.

            Line 1346 comment is confusing. Maybe just remove it.

          • Patch Set #29, Line 1347: linkName, err := os.Readlink(pythonPath)

            This implementation is fine. I also OK if os.Readlink returns some error here.

        • File src/os/stat_windows.go:

          • Done

            Bryan asked you to copy some details from https://github.com/dotnet/runtime/pull/58233#issuecomment-911971904 and add them to this comment. But you removed the comment altogether.

            And why did you add faErr?

            And why did you add call to isAppExecLink? I think ERROR_CANT_ACCESS_FILE is good enough to identify APPLINK file.

            I just run your tests on my laptop and they fail with:

            ```
            === RUN TestAppExecLinkStat
            os_windows_test.go:1299: os.Lstat("C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe") = &{name:python3.exe FileAttributes:1056 CreationTime:{LowDateTime:1510765494 HighDateTime:30857418} LastAccessTime:{LowDateTime:699192412 HighDateTime:30993647} LastWriteTime:{LowDateTime:699192412 HighDateTime:30993647} FileSizeHigh:0 FileSizeLow:0 Reserved0:2147483675 filetype:1 Mutex:{state:0 sema:0} path: vol:4030669601 idxhi:196608 idxlo:9214 appendNameToPath:false}
            os_windows_test.go:1300: os.Stat("C:\\Users\\user\\AppData\\Local\\Microsoft\\WindowsApps\\python3.exe") = &{name:python3.exe FileAttributes:1056 CreationTime:{LowDateTime:1510765494 HighDateTime:30857418} LastAccessTime:{LowDateTime:699192412 HighDateTime:30993647} LastWriteTime:{LowDateTime:699192412 HighDateTime:30993647} FileSizeHigh:0 FileSizeLow:0 Reserved0:0 filetype:0 Mutex:{state:0 sema:0} path:C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe vol:0 idxhi:0 idxlo:0 appendNameToPath:false}
            os_windows_test.go:1301: files should be same
            --- FAIL: TestAppExecLinkStat (0.59s)
            === RUN TestAppExecLinkReadlink
            --- PASS: TestAppExecLinkReadlink (0.00s)
            ```
        • File src/os/types_windows.go:

          • How do we know that only an APPEXECLINK can trigger this error?

          • Might it also apply to other reparse points?

          • I don't know that APPEXECLINK triggers ERROR_CANT_ACCESS_FILE.

            Jan discovered that.

            And I confirmed his discovery on my laptop.

            And then I googled for it and I found https://github.com/dotnet/runtime/pull/58233/files (search this PR for ERROR_CANT_ACCESS_FILE).

            And I also asked @quimm...@gmail.com to confirm or deny our discovery. But Quim did not comment on that yet.

          • If the call to CreateFile with FILE_FLAG_OPEN_REPARSE_POINT set also fails, should we return the error from the original CreateFile call, or the one with FILE_FLAG_OPEN_REPARSE_POINT set? (A code comment with a rationale would be helpful.)

          • I don't understand what you are referring to here. Please try again.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 29
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Sun, 25 Dec 2022 02:18:45 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>

        Jan De Dobbeleer (Gerrit)

        unread,
        Dec 25, 2022, 10:52:43 AM12/25/22
        to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        View Change

        5 comments:

        • Patchset:

          • Patch Set #29:

            Thank you everyone for pushing this along. See my comments below. […]

            Why do I need to remove? I addressed @bcm...@google.com 's comments with these changes. I'll reply inline.

        • File src/os/os_windows_test.go:

          • Is it possible to join this test with TestAppExecLinkStat ? So we have less tests to look at. […]

            Sure

          • Patch Set #29, Line 1346: If it does, we should update our implementation.

            Line 1346 comment is confusing. Maybe just remove it.

          • Ack

        • File src/os/stat_windows.go:

          • you removed the comment

            I did not remove that, I moved it to `readlink`.

          • And why did you add faErr?

          • Because of @bcm...@google.com 's remark about it being possible that `fa` is not valid so we need to double check that error as well before we deal with `fa` blindly.

          • I think ERROR_CANT_ACCESS_FILE is good enough to identify APPLINK file.

          • There @bcm...@google.com seemed to disagree, this way at least it will always be an actual AppExecLink

            If this isn't OK can you two please agree offline first, then provide feedback as I'm going in circles here. It's really demotivating to address comments then a week later having to come back to this.

          • I just run your tests on my laptop and they fail

          • This is your test, I did not change this one 😊

        • File src/os/types_windows.go:

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 29
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Sun, 25 Dec 2022 15:52:36 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>

        Gerrit Bot (Gerrit)

        unread,
        Dec 25, 2022, 10:54:06 AM12/25/22
        to Jan De Dobbeleer, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        Gerrit Bot uploaded patch set #30 to this change.

        View Change

        The following approvals got outdated and were removed: Run-TryBot+1 by Alex Brainman, TryBot-Result-1 by Gopher Robot

        os: add support for AppExecLinks

        This change adds support for AppExecLinks files, like

        C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe

        The python3.exe can be installed by following these

        https://www.microsoft.com/store/productId/9PJPW5LDXLZ5

        instructions. The executable is added to your PATH and can be called
        from command line, like `python3 --version`.

        Calling GetFileAttributesEx on python3.exe returns FileAttributes with
        FILE_ATTRIBUTE_REPARSE_POINT set. And os.Stat attempts to follow the
        link. But Microsoft does not provide any link target for AppExecLinks
        files (see
        https://github.com/dotnet/runtime/pull/58233#issuecomment-911971904 ),
        and Go should treat AppExecLinks as normal files and not symlinks.

        This CL adjusts os.Stat implementation to return normal file
        os.FileInfo
        for AppExecLinks files instead of symlinks. The AppExecLinks files are
        recognised as they return ERROR_CANT_ACCESS_FILE from CreateFile call.
        The trick is not documented anywhere. Jan De Dobbeleer discovered the
        trick. Also https://github.com/dotnet/runtime/pull/58233 appears to
        also
        use ERROR_CANT_ACCESS_FILE to distinguish AppExecLinks files.

        The CL also adds new tests.

        The CL is an extended copy of the Jan De Dobbeleer
        https://go-review.googlesource.com/c/go/+/384160 CL.

        Fixes #42919

        Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        GitHub-Last-Rev: 1fee03151d26b9e9682053bfaa7088f0ffaa6e09

        GitHub-Pull-Request: golang/go#51081
        ---
        M src/internal/syscall/windows/reparse_windows.go
        M src/internal/syscall/windows/syscall_windows.go
        M src/os/file_windows.go
        M src/os/os_windows_test.go
        M src/os/stat_windows.go
        M src/os/types_windows.go
        6 files changed, 162 insertions(+), 6 deletions(-)

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-MessageType: newpatchset

        Alex Brainman (Gerrit)

        unread,
        Dec 26, 2022, 9:39:11 PM12/26/22
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

        Patch set 30:Code-Review +2

        View Change

        4 comments:

        • Patchset:

          • Patch Set #29:

            Why do I need to remove? I addressed @bcm...@google.com 's comments with these changes. […]

            I asked you to make sure new test PASSes on you laptop. And mine.

        • File src/os/os_windows_test.go:

          • Patch Set #29, Line 1298: if !os.SameFile(lfi, sfi) {

            Why did you removed os.SameFile test? Please revert the change. We want os.SameFile working properly. No?

        • File src/os/stat_windows.go:

          • I think ERROR_CANT_ACCESS_FILE is good enough to identify APPLINK file.

          • There @bcm...@google.com seemed to disagree, this way at least it will always be an actual AppExecLink.

            We don't actually know which code is correct, because Microsoft did not document anything. So I prefer less code. As long as our test PASSes I am good.


          • If this isn't OK can you two please agree offline first, then provide feedback as I'm going in circles here. It's really demotivating to address comments then a week later having to come back to this.

          • I am happy to wait for Bryan to confirm if he wants more changes on top of +1 he gave at Patch Set 25.

            I agree that this CL is too long. But we did not know how to fix this problem at the start. We still can change if we discover more details here.

            I warned you that this change is large. And we don't want to break any of existing code. And I expect you will need to rebase this code before it gets merged.

            And reviewers cannot agree offline. We don't discuss this CL offline. This CL is where we all discuss and make decisions.

            And I only have so much time to spend on your CL. I do this for free on top of everything I have to do in my life. I need to share my time before this CL and many other CLs and issues.

            But if other reviewers give you +2, then you don't need to wait for my review. The only problem for them is that they don't really run the test.


          • > I just run your tests on my laptop and they fail

            This is your test, I did not change this one 😊

          • We wrote the test together. You started and I added more tests to it.

            But I expect you to run that test on your laptop before you post any changes here. That is the only way to verify your changes.

        • File src/os/types_windows.go:

          • That's why I added `faErr`

            Jan. Let's wait for Bryan to reply before continuing this thread.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Tue, 27 Dec 2022 02:39:04 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes

        Jan De Dobbeleer (Gerrit)

        unread,
        Dec 27, 2022, 9:56:09 AM12/27/22
        to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        View Change

        3 comments:

          • I suggest you remove as much changes as you made since that Patch Set.

        • File src/os/os_windows_test.go:

          • Why did you removed os.SameFile test? Please revert the change. We want os. […]

            That's the one which caused things to fail, but I did not toch that part. It still returned the "same" file buit some properties were different for some reason.

        • File src/os/stat_windows.go:

          • I'll try to understand why that test now fails, BTW I always rebase before I push so that should be good.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Tue, 27 Dec 2022 14:56:00 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No

        Jan De Dobbeleer (Gerrit)

        unread,
        Dec 27, 2022, 10:15:07 AM12/27/22
        to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Russ Cox, Sachin Joseph.

        View Change

        1 comment:

        • File src/os/os_windows_test.go:

          • That's the one which caused things to fail, but I did not toch that part. […]

            @alex.b...@gmail.com I don't understand how this test succeeded on your end to begin with. It fails because `Reserved0` and other elements which weren't ever set in Lstat are different. This wasn't touched by me unless some recent changes in master are causing this.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Tue, 27 Dec 2022 15:14:59 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>

        Quim Muntal (Gerrit)

        unread,
        Dec 27, 2022, 2:39:25 PM12/27/22
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

        View Change

        2 comments:

        • File src/os/os_windows_test.go:

          • We already skip this test if os.Lstat("C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3. […]

            Hmmm, that lstat does not skip the test on my computer. I'm afk for a week, will check what the lstat returns when I go back to work.

        • File src/os/types_windows.go:

          • Jan. Let's wait for Bryan to reply before continuing this thread.

            Will investigate this next week.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Tue, 27 Dec 2022 19:39:18 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>
        Comment-In-Reply-To: Alex Brainman <alex.b...@gmail.com>

        Alex Brainman (Gerrit)

        unread,
        Dec 27, 2022, 3:10:37 PM12/27/22
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Quim Muntal, Russ Cox, Sachin Joseph.

        Patch set 30:-Code-Review

        View Change

        5 comments:

        • Patchset:

          • Patch Set #29:

            This sentence confused me I guess: […]

            You copied my changes as Patch Set 25. And new test PASSed back then. And now test is broken. That is why I suggested that you remove the changes you made since Patch Set 25. To make test work again. I hope my suggestion is clear this time.

        • File src/os/os_windows_test.go:

          • Hmmm, that lstat does not skip the test on my computer. […]

            Thanks for checking. No worries we will wait until you are back to work. We need to wait for Go tree to be opened anyway.

        • File src/os/os_windows_test.go:

          • I'll try to understand why that test now fails, BTW I always rebase before I push so that should be […]

            Don't waste time rebasing your changes. You are making it harder for yourself and everyone else to develop this CL. Let's make the CL work and approved on that particular commit, and then we can rebase it before submitting.

            I know that there are approved changes in that code already. These changes will be merged before your changes. So you would have to rebase regardless of what you do now. So delay that rebase until everyone is happy.

        • File src/os/types_windows.go:

          • Will investigate this next week.

            Quim sounds good.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Comment-Date: Tue, 27 Dec 2022 20:10:30 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes

        Quim Muntal (Gerrit)

        unread,
        Jan 4, 2023, 10:31:05 AM1/4/23
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Russ Cox, Sachin Joseph.

        View Change

        4 comments:

        • File src/os/os_windows_test.go:

          • Thanks for checking. No worries we will wait until you are back to work. […]

            I'm getting the error code 90009 when `C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe` reparse point exists (as a 0-length file) but python3 is still not installed from the Windows Store, so running `python3.exe` launches the Windows Store instead of running the python interpreter.

        • File src/os/stat_windows.go:

          • Patch Set #30, Line 71: if faErr == nil && err == windows.ERROR_CANT_ACCESS_FILE {

            This condition can be tightened by checking that the target file is a reparse point and that we did not call `CreateFile` with `FILE_FLAG_OPEN_REPARSE_POINT`, i.e.:

            • fa.FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0
            • createFileAttrs&syscall.FILE_FLAG_OPEN_REPARSE_POINT == 0

            `isAppExecLink` is not cheap, so we better reduce the false positive rate.

        • File src/os/types_windows.go:

          • Quim sounds good.

            I've added a couple of comments about `ERROR_CANT_ACCESS_FILE` next to the relevant code sections.

        • File src/os/types_windows.go:

          • Patch Set #30, Line 173: if err == windows.ERROR_CANT_ACCESS_FILE {

            `CreateFile` will not fail with `ERROR_CANT_ACCESS_FILE` if attrs contains `FILE_FLAG_OPEN_REPARSE_POINT`, so the `isAppExecLink` can be avoided by checking if `fs.Reserved0 == windows.IO_REPARSE_TAG_APPEXECLINK` in addition to `fs.isSymlink()` in the previous if-case. @bcm...@google.com @alex.b...@gmail.com I wonder if we should update `isSymlink` to account for this additional case.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Comment-Date: Wed, 04 Jan 2023 15:30:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No

        Bryan Mills (Gerrit)

        unread,
        Jan 5, 2023, 10:24:02 AM1/5/23
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Quim Muntal, Russ Cox, Sachin Joseph.

        Patch set 30:Code-Review +1Hold +1

        View Change

        9 comments:

        • File src/os/os_windows_test.go:

          • I'm getting the error code 90009 when `C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3. […]

            The error reported in the issue most likely comes from `os/exec.findExecutable`. If that is the case, it should suffice to check that `exec.LookPath` resolves it to itself — we shouldn't need to actually run it.

        • File src/os/stat_windows.go:

          • Patch Set #25, Line 71: if err == windows.ERROR_CANT_ACCESS_FILE {

            This seems backwards: we are calling `CreateFile` without `FILE_FLAG_OPEN_REPARSE_POINT` as if resolving a symlink target, but at this point we don't even know that the file is a symlink. (All that we know about it is that it is a reparse point.)

            So we should start by obtaining the reparse tag (using either `FindFirstFile`, or `CreateFile` with `FILE_FLAG_OPEN_REPARSE_POINT` set), and only then try `CreateFile` without the flag set.

            The first `CreateFile` call will not fail with `ERROR_CANT_ACCESS_FILE`, and will report an `APPEXECLINK` as a non-symlink (because its reparse tag does not indicate a symlink). Then we don't need any special cases for `APPEXECLINK` — the correct behavior follows from the general case instead.

          • So I prefer less code. As long as our test PASSes I am good.

          • All else equal, I too prefer less code over more. But I also have a very hard time believing that an error code as old and general as `ERROR_CANT_ACCESS_FILE` is specific to a feature as new as `IO_REPARSE_TAG_APPEXECLINK`.

            (The TDD approach of “write the minimal code that passes tests” relies on having tests that cover all of the behaviors that users realistically require, but the rate of Windows issues we get in the Go issue tracker suggests to me that our tests do not yet meet that very high bar.)

        • File src/os/stat_windows.go:

          • This condition can be tightened by checking that the target file is a reparse point and that we did […]

            `stat` has only two call sites, and they both pass hard-coded attrs for the `createFileAttrs` argument.

            • The call in `statNoLog` passes `FILE_FLAG_BACKUP_SEMANTICS`.
            • The call in `lstatNoLog` passes `FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_OPEN_REPARSE_POINT`.

            I suggest that we simplify this function by changing the `createFileAttrs` argument to `followSymlinks bool`, which will make it easier to reason locally about this function:

            ```
            createFileAttrs := uint32(syscall.FILE_FLAG_BACKUP_SEMANTICS)
            if !followSymlinks {
            // Open the symlink itself, not its target.
            createFileAttrs |= syscall.FILE_FLAG_OPEN_REPARSE_POINT
            }
            ```
        • File src/os/types_windows.go:

        • File src/os/types_windows.go:

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Comment-Date: Thu, 05 Jan 2023 15:23:52 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes

        Bryan Mills (Gerrit)

        unread,
        Jan 5, 2023, 10:31:30 AM1/5/23
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Alex Brainman, Brad Fitzpatrick, Ian Lance Taylor, Jan De Dobbeleer, Quim Muntal, Russ Cox, Sachin Joseph.

        View Change

        2 comments:

        • File src/os/stat_windows.go:

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Comment-Date: Thu, 05 Jan 2023 15:31:23 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>

        Alex Brainman (Gerrit)

        unread,
        Jan 15, 2023, 2:08:51 AM1/15/23
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Attention is currently required from: Brad Fitzpatrick, Bryan Mills, Ian Lance Taylor, Jan De Dobbeleer, Quim Muntal, Russ Cox, Sachin Joseph.

        View Change

        2 comments:

        • Patchset:

          • Patch Set #30:

            I think that Bryan come up with much better solution for issue #42919 in CL 460595. We should proceed with CL 460595 instead of this CL.

            Alex

        • File src/os/os_windows_test.go:

          • @quimm...@gmail.com

            I'm getting the error code 90009 when C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe reparse point exists (as a 0-length file) but python3 is still not installed from the Windows Store ...

            Is there a way for me reproduce error with code 90009 here?

            I can find another computer without python installed on it from Windows Store. What would I need to do?

            Just wondering if we can extend our test with error code 90009.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Sachin Joseph <sachin...@gmail.com>
        Gerrit-Attention: Russ Cox <r...@golang.org>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Comment-Date: Sun, 15 Jan 2023 07:08:44 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Bryan Mills <bcm...@google.com>
        Comment-In-Reply-To: Alex Brainman <alex.b...@gmail.com>

        Ian Lance Taylor (Gerrit)

        unread,
        Jan 23, 2023, 7:08:07 PM1/23/23
        to Jan De Dobbeleer, Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, Alex Brainman, Bryan Mills, Quim Muntal, Sachin Joseph, Russ Cox, Ian Lance Taylor, Brad Fitzpatrick, golang-co...@googlegroups.com

        Ian Lance Taylor abandoned this change.

        View Change

        Abandoned Abandoning based on Alex's comment that CL 460595 is better. We can restore this one if that turns out to be incorrect. Thanks.

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

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I5a0a72eaba2a5b9c242b7ac32dd343fcc01e09e6
        Gerrit-Change-Number: 384160
        Gerrit-PatchSet: 30
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Russ Cox <r...@golang.org>
        Gerrit-Reviewer: Sachin Joseph <sachin...@gmail.com>
        Gerrit-CC: Jan De Dobbeleer <jan.de.d...@gmail.com>
        Gerrit-CC: Quim Muntal <quimm...@gmail.com>
        Gerrit-MessageType: abandon
        Reply all
        Reply to author
        Forward
        0 new messages