https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0cfa0465d13e77221a0d8d72d2c0dd4588bb387f
commit 0cfa0465d13e77221a0d8d72d2c0dd4588bb387f Author: Takashi Yano <[email protected]> Date: Wed Dec 17 17:03:33 2025 +0900 Cygwin: path: Implement path_conv::is_app_execution_alias() An app execution alias cannot be opened for read (CreateFile() with GENERIC_READ fails with ERROR_CANT_ACCESS_FILE) because it does not resolve the reparse point for app execution alias. Therefore, we need to know if the path is an app execution alias when opening it. This patch adds new api path_conv::is_app_execution_alias() for that purpose. Reviewed-by: Johannes Schindelin <[email protected]> Signed-off-by: Takashi Yano <[email protected]> Diff: --- winsup/cygwin/local_includes/path.h | 5 +++++ winsup/cygwin/path.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/local_includes/path.h b/winsup/cygwin/local_includes/path.h index a9ce2c7e4..ad142ddd3 100644 --- a/winsup/cygwin/local_includes/path.h +++ b/winsup/cygwin/local_includes/path.h @@ -79,6 +79,7 @@ enum path_types PATH_SOCKET = _BIT ( 5), /* AF_UNIX socket file */ PATH_RESOLVE_PROCFD = _BIT ( 6), /* fd symlink via /proc */ PATH_REP_NOAPI = _BIT ( 7), /* rep. point unknown to WinAPI */ + PATH_APPEXECLINK = _BIT ( 8), /* rep. point app execution alias */ PATH_DONT_USE = _BIT (31) /* conversion to signed happens. */ }; @@ -214,6 +215,10 @@ class path_conv { return (path_flags & (PATH_REP | PATH_REP_NOAPI)) == PATH_REP; } + int is_app_execution_alias () const + { + return path_flags & PATH_APPEXECLINK; + } int isfifo () const {return dev.is_device (FH_FIFO);} int iscygdrive () const {return dev.is_device (FH_CYGDRIVE);} diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 710775e38..625e60686 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2661,7 +2661,7 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp, if (i == 2 && n > 0 && n < size) { RtlInitCountedUnicodeString (psymbuf, buf, n * sizeof (WCHAR)); - return PATH_SYMLINK | PATH_REP; + return PATH_SYMLINK | PATH_REP | PATH_APPEXECLINK; } if (i == 2) break;
