[ANNOUNCEMENT] TEST: Cygwin 3.0.0-0.7

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Feb 8 12:23:00 GMT 2019


On Feb  8 13:21, Corinna Vinschen wrote:
> On Feb  8 12:51, Michael Haubenwallner wrote:
> > 
> > 
> > On 2/8/19 12:31 PM, Corinna Vinschen wrote:
> > > On Feb  8 07:46, Michael Haubenwallner wrote:
> > >>
> > >> On 2/7/19 7:27 PM, Corinna Vinschen wrote:
> > >>> On Feb  7 17:14, Michael Haubenwallner wrote:
> > >>>> On 2/5/19 4:18 PM, Corinna Vinschen wrote:
> > >>>>> Hi folks,
> > >>>>>
> > >>>>>
> > >>>>> I uploaded a new Cygwin test release 3.0.0-0.7
> > >>>>>
> > >>>>
> > >>>>> Please test.
> > >>>>>
> > >>>>
> > >>>> There's another regression - regarding spawn, exec and waitpid,
> > >>>> loosing the exitstatus somewhere in between:
> > >>>>
> > >>>
> > >>> Any chance you could take a look?  I haven't much time for Cygwin the
> > >>> next couple of days.
> > >>
> > >> Ok, will do. Any hints probably?
> > > 
> > > Thanks!  The only thing coming to mind is the removal of the parent
> > > handle when switching PID method.  Or maybe the permission restriction
> > > on the process handles?
> > 
> > For now it seems like there's an inconsistency with PIDs:
> > A first process PID 100, receives PID 101 from spawn(),
> > but in the new process getpid() returns 102:
> > 
> > $ ./dospawn /bin/bash -c 'echo $$'
> > 12625
> > waitpid: pid 12624 status 0x0
> 
> Oh, hmm.  If you call spawnve, rather than execve, a new child pid
> is generated in spawnve, rather than just keeping the callers pid.
> 
> However, apparently the child invents its own pid in pinfo::thisproc
> after being spawned.  But actually this should only occur for forked
> processes aore processes started from non-Cygwin parents.

Does that help, by any chance:

diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 78506d43de29..0b274287d9f6 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -656,7 +656,7 @@ child_info_spawn::handle_spawn ()
       !DuplicateHandle (GetCurrentProcess (), moreinfo->myself_pinfo,
 			GetCurrentProcess (), &h, 0,
 			FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
-    h = NULL;
+    h = INVALID_HANDLE_VALUE;
 
   /* Setup our write end of the process pipe.  Clear the one in the structure.
      The destructor should never be called for this but, it can't hurt to be
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 445bd35b224e..d10c4fc4580c 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -62,6 +62,8 @@ pinfo::thisproc (HANDLE h)
       cygheap->pid = create_cygwin_pid ();
       flags |= PID_NEW;
     }
+  else if (h == INVALID_HANDLE_VALUE)
+    h = NULL;
 
   init (cygheap->pid, flags, h);
   procinfo->process_state |= PID_IN_USE;


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190208/65fbe9ca/attachment.sig>


More information about the Cygwin mailing list