forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 dotnet/runtime#58233 (comment) ), 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 dotnet/runtime#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 golang#42919 Change-Id: I8b5a26d0cac7882d3445393d26b182ad31cd753b
- Loading branch information
1 parent
9b8750f
commit 1b731b3
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters