delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2026/11/06/06:30:43

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 6A6BUgKv2428359
Authentication-Results: delorie.com; dmarc=pass (p=quarantine dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 6A6BUgKv2428359
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=X6V0zjuN
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B1A34BA2E14
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1793964640;
bh=xEfFoOcMYCpyHNWoQsMCU94qEWTaabJ49UTF3lAZZ28=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=X6V0zjuNJs0mx2RfxnNs6rNyd7yzSclR7KCGj+P87VNNT2d7c7BfUEC1J8cJExxil
J6X1iObBT1NRwo5D0U/BMFU89kCD2ON862nTg+2xUBeilDJ3pcV+zrFgtWFSBw2Jf3
jxK1CESCRe+i9/EpT775OiWQFc5hcI2UidR+fbmQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 409C64BA2E0B
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 409C64BA2E0B
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793964616; cv=none;
b=MJSaZtxDGfmRiiX4lR78uRfDU3gK9WgKe8s87L9om63W5sN//F2t+t7ZTvvr3dxzNHtdn7WdbvrJzfaQjCvzBJcr02aCmqFnGacCgIkazak/HdoSech/iA37IFMG6PySuLEepAMF+2cM5keFM+EMVwnhq2TOygntMww/OG03uoo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1793964616; c=relaxed/simple;
bh=HiK8FnNeWa1tt1jJ2mFmtiiZLbT+gCuCTntgf0TzD08=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=QMKuI5uz146IzINxAJmIHUoyfH+sZz7J101I3NCdYEgSunCVAP0mV5EutYq6w5+9Z3+y9CM22zNjDP06ZD5jzrm9nRnz5wEa671FmKRjpiudWTVSef2DUyXiLKI0q6lZoPC+XRQ03ENd2dSBMlVUVGqjvXd4/JnfAsw/qQ8J774=
ARC-Authentication-Results: i=1; sourceware.org;
dkim=pass (2048-bit key, unprotected)
header.d=nifty.ne.jp header.i=@nifty.ne.jp header.a=rsa-sha256
header.s=default-1th84yt82rvi header.b=plY+bL5A
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 409C64BA2E0B
Date: Fri, 6 Nov 2026 20:30:10 +0900
To: cygwin AT cygwin DOT com
Subject: Re: 3.6.11: ps -ef omits sh started by system() and popen()
(Windows 10)
Message-Id: <20261106203010.87955c355323e31c9aed29aa@nifty.ne.jp>
In-Reply-To: <CACWrzRJ4W1tn=06TvpXaB319BuGmk8cJxoF20v445n=ZwEk59A@mail.gmail.com>
References: <CACWrzRKzkGLAiNrEw+aSwSgHujE-uq--Mi8mjdoLYEbJbOzMVw AT mail DOT gmail DOT com>
<1341672297 DOT 20261029110214 AT yandex DOT ru>
<CACWrzRJ4W1tn=06TvpXaB319BuGmk8cJxoF20v445n=ZwEk59A AT mail DOT gmail DOT com>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On Sun, 1 Nov 2026 10:31:00 +0500
Daniyar Oshakbayev wrote:
> >
> >
> > Hi, Andrey ($B'1'b'Z'S'V'd'c'd'S'e'p(B!)
> >
> > Thanks for the reply. I think I explained it badly, so here is the
> > simplest case I started from.
> >
> > This is the whole program:
> >
> >   #include <stdlib.h>
> >   int main(void)
> >   {
> >       system("echo shell pid=$$ ppid=$PPID; ps -ef; echo done");
> >       return 0;
> >   }
> >
> > Here is what I get today. My program (./a) is 1233, the shell started
> > by system() is 1240, and "ps" is 1241:
> >
> >   shell pid=1240 ppid=1233
> >        UID     PID    PPID  TTY        STIME COMMAND
> >   user        1241    1240  pty0     10:17:41 ps -ef
> >   user        1233    1229  pty0     10:17:40 ./a
> >   (other rows left out)
> >   done
> >
> > So the shell (1240) started "ps" (1241), which is why "ps" shows 1240
> > as its parent. But when "ps" lists all processes, there is no line for
> > 1240. The parent of "ps" is missing from the list. The shell is clearly
> > still alive, because it prints "done" after "ps" finishes.
> >
> > In my tests the shell is listed by "ps -ef" when I start the same
> > /bin/sh with fork() and exec, or with posix_spawn(). It is not listed
> > when I start it with system() or popen(). I tried these four ways, and
> > the test program and its output are attached to my first message.
> >
> > So my question is simple: is it expected that "ps -ef" does not list
> > the shell started by system()? If yes, that is fine, I just want to
> > know whether this is how Cygwin is supposed to work.
> >
> > If you want the longer details, I can send them.
> >
> > Thanks

Thanks for the report. This seems to be a bug since cygwin 3.3.6.
I'll submit a patch to fix the issue.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2026   by DJ Delorie     Updated Sep 20 2026