Hi Takashi, On Sat, 22 Oct 2022, Takashi Yano wrote:
> On Sat, 22 Oct 2022 07:58:37 +0200 > Johannes Schindelin wrote: > > On October 22, 2022 7:34:20 AM GMT+02:00, Takashi Yano > > <takashi.y...@nifty.ne.jp> wrote: > > >- If the command executed is 'cmd.exe /c [...]', runpath in spawn.cc > > > will be NULL. In this case, is_console_app(runpath) check causes > > > access violation. This case also the command executed is obviously > > > console app., therefore, treat it as console app to fix this issue. > > > > > > Addresses: https://github.com/msys2/msys2-runtime/issues/108 > > >--- > > > winsup/cygwin/spawn.cc | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > >diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc > > >index 5aa52ab1e..4fc842a2b 100644 > > >--- a/winsup/cygwin/spawn.cc > > >+++ b/winsup/cygwin/spawn.cc > > >@@ -215,6 +215,8 @@ handle (int fd, bool writing) > > > static bool > > > is_console_app (WCHAR *filename) > > > { > > >+ if (filename == NULL) > > >+ return true; /* The command executed is command.com or cmd.exe. */ > > > HANDLE h; > > > const int id_offset = 92; > > > h = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ, > > > > The commit message of the original patch was substantially clearer and > > offered a thorough analysis. This patch lost that. > > The reason which I did not apply your patch as-is is: > is_console_app() returns false for 'cmd.exe /c [...]' case > with your patch, while it should return true. Sure. And a simple "can you please modify the patch to return `true` in the `cmd /c <command>` case" feedback would have avoided all the contention. Having said that, I fear that you completely misread what I wrote, as I did not comment on your diff but on your quite improvable commit message. Ciao, Johannes