Skip to content

Commit 647dff4

Browse files
committed
Allow executing Windows Store's "app execution aliases"
The Windows Store version of Python (and apparently other Windows Store applications) install a special reparse point called "app execution alias" into the user's `PATH`. These applications can be executed without any problem, but they cannot be read as if they were files. This trips up Cygwin's beautiful logic that tries to determine whether we're about to execute a Cygwin executable or not: instead of executing the application, it will fail, saying "Permission denied". Let's detect this situation (`NtOpenFile()` helpfully says that this operation is not supported on this reparse point type), and simply skip the logic: Windows Store apps are not Cygwin executables (and even if they were, it is unlikely that they would come with a compatible `cygwin1.dll` or `msys-2.0.dll`). This fixes msys2/MSYS2-packages#1943 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 218dc58 commit 647dff4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

winsup/cygwin/spawn.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,13 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext,
11661166
FILE_SYNCHRONOUS_IO_NONALERT
11671167
| FILE_OPEN_FOR_BACKUP_INTENT
11681168
| FILE_NON_DIRECTORY_FILE);
1169+
if (status == STATUS_IO_REPARSE_TAG_NOT_HANDLED)
1170+
{
1171+
/* This is most likely an app execution alias (such as the
1172+
Windows Store version of Python, i.e. not a Cygwin program */
1173+
real_path.set_cygexec (false);
1174+
break;
1175+
}
11691176
if (!NT_SUCCESS (status))
11701177
{
11711178
/* File is not readable? Doesn't mean it's not executable.

0 commit comments

Comments
 (0)