public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Takashi Yano <takashi.yano@nifty.ne.jp>
Cc: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'
Date: Sun, 23 Oct 2022 22:42:07 +0200 (CEST)	[thread overview]
Message-ID: <n4on0p20-970q-8693-7n50-4q22370s7rr5@tzk.qr> (raw)
In-Reply-To: <20221022151247.1b1cf1e3fc13d4c3dabc2191@nifty.ne.jp>

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.yano@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

  reply	other threads:[~2022-10-23 20:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22  5:34 Takashi Yano
2022-10-22  5:58 ` Johannes Schindelin
2022-10-22  6:12   ` Takashi Yano
2022-10-23 20:42     ` Johannes Schindelin [this message]
2022-10-24  9:28       ` Corinna Vinschen
2022-11-18  8:23         ` Johannes Schindelin
2022-11-19 21:38           ` Jeremy Drake
2022-11-21 11:47           ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=n4on0p20-970q-8693-7n50-4q22370s7rr5@tzk.qr \
    --to=johannes.schindelin@gmx.de \
    --cc=cygwin-patches@cygwin.com \
    --cc=takashi.yano@nifty.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).