From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id DB9AB3861031; Tue, 23 Mar 2021 15:58:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB9AB3861031 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: Allow executing Windows Store's "app execution aliases" X-Act-Checkin: newlib-cygwin X-Git-Author: Johannes Schindelin X-Git-Refname: refs/heads/master X-Git-Oldrev: ef05e8bdae87b9a72a709a7a7054543aab45992a X-Git-Newrev: 2533912fc76c08af9e386a371fc6b3eb194d56be Message-Id: <20210323155846.DB9AB3861031@sourceware.org> Date: Tue, 23 Mar 2021 15:58:46 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Mar 2021 15:58:47 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2533912fc76c08af9e386a371fc6b3eb194d56be commit 2533912fc76c08af9e386a371fc6b3eb194d56be Author: Johannes Schindelin Date: Mon Mar 22 16:51:48 2021 +0100 Cygwin: 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 https://github.com/msys2/MSYS2-packages/issues/1943 Signed-off-by: Johannes Schindelin Diff: --- winsup/cygwin/spawn.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 7a585392a..ec0cdd408 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -1276,6 +1276,13 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext, FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT | FILE_NON_DIRECTORY_FILE); + if (status == STATUS_IO_REPARSE_TAG_NOT_HANDLED) + { + /* This is most likely an app execution alias (such as the + Windows Store version of Python, i.e. not a Cygwin program */ + real_path.set_cygexec (false); + break; + } if (!NT_SUCCESS (status)) { /* File is not readable? Doesn't mean it's not executable.