Files
MSYS2-packages/msys2-runtime/0042-Cygwin-path-Implement-path_conv-is_app_execution_ali.patch
Johannes Schindelin 2e9934c695 msys2-runtime: Fix stdio with app execution aliases (Microsoft Store applications) (#5932)
When I introduced support for executing Microsoft Store applications through their "app execution aliases", I had missed that it failed to spawn the process with the correct handles to the terminal, breaking interactive usage of, say, the Python interpreter.

This corresponds to https://github.com/msys2/msys2-runtime/pull/322
2026-01-05 18:38:49 +01:00

59 lines
2.2 KiB
Diff

From 7431d3f3470b46d6cbbcbdf6aeb712a446ae6fcc Mon Sep 17 00:00:00 2001
From: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Fri, 19 Dec 2025 11:26:37 +0900
Subject: [PATCH 42/N] 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 <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
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 a9ce2c7..ad142dd 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 c1298a4..bcde89c 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2921,7 +2921,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;