On Fri, 11 Jul 2025, Jeremy Drake via Cygwin-developers wrote:

> On Fri, 11 Jul 2025, Jon Turney wrote:
>
> > On 08/07/2025 20:02, Jeremy Drake via Cygwin-developers wrote:
> > > I've run into an odd issue with exec and kill in winsup/testsuite that
> > > doesn't happen in a more normal configuration.  What I'm doing is getting
> >
> > This is odd.
> >
> > Jst so I'm clear: This works when run normally, but but fails when run in 
> > the
> > testsuite?
>
> Correct.
>
> > > the pid via getpid (), then forking.  In the forked child, I can call kill
> > > (pid, SIGUSR1) without issue, but if instead I call execv (passing the
> > > pid as an argument) and then call kill after the exec I get "No such
> > > process" error.  Can anyone tell what I'm doing wrong?
> > >
> > > Here's the test output:
> > > kill after exec: No such process
> > > SUCCESS: The process with PID 3748 (child process of PID 5984) has been
> > > terminated.
> > > Timeout
> > > FAIL winsup.api/killissue.exe (exit status: 124)
> > >
> > > And here's a test with the working fork/kill if 0'ed out and the broken
> > > fork/exec/kill in place:
> > > [...]
> >
> > Weird.
> >
> > The only think I can think of right now is if somehow the
> > execv("/proc/self/exe") is escaping the testinst, and running against the
> > (different) installed cygwin DLL instead?
> >
> > But that doesn't seem very plausible.
>
> Yeah.  I wonder if this is related to the pgid of 0 I was seeing in the
> testsuite also.  I'll see if I can get any more info out of a test.


I added a GetModuleHandle/GetModuleFileName to the child, and got
D:\a\cygwin\cygwin\build\x86_64-pc-cygwin\winsup\testsuite\testinst\bin\cygwin1.dll
 so it seems to be using the testinst.  I also switched to exec /bin/sh
(busybox) with argv[0] of "ps", and only saw
PID USER TIME COMMAND
 1504 runnerad 0:00 
/cygdrive/d/a/cygwin/cygwin/build/x86_64-pc-cygwin/winsup/cygserver/cygserver

Reply via email to