delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/23/04:25:58

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=f6BuVVDJbKu/+1DMLjW8Uh3DQFWvwHTkm9kwWQy8h6KDO/6ffRqYY
/gz/4EG1RIFI3OcmgaEhutRVVjOhkzFQ5sJUaps1BCd34Do0qK/2LqZ+2SqSG/bZ
8OZhGVMbTJDAGziy6KnEM8eabufGXIi+CQs+WS/A5RQM5gMhijkQQU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=2hPydSPbkvg36SsPMBep9ecV1Y4=; b=R/7sunSdMofqjjfT/srIC4zajOq2
wARWTeX9WY6fZGoQNEGjjbmRlYaUqqfJch44RuRGjUPZYaTmJD8Odx3btSf4+WRi
3JK3dNm9j5KhrV0ToCqgD81Hi1nUwqFCiUJfxFS7AnvKU28hGvWAx595RR/CP3+o
B82Xo1d0vl8+Z3o=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Wed, 23 Oct 2013 10:25:35 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: ps weirdness...
Message-ID: <20131023082535.GA5134@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <21093 DOT 42532 DOT 550364 DOT 992074 AT consult DOT pretender>
MIME-Version: 1.0
In-Reply-To: <21093.42532.550364.992074@consult.pretender>
User-Agent: Mutt/1.5.21 (2010-09-15)

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Oct 21 18:09, cygwin wrote:
> When I type 'ps', I get as expected the following processes:
>=20
>       PID    PPID    PGID     WINPID   TTY     UID    STIME COMMAND
>     18036    3188   18036      17792  pty0    1001 16:54:33 /usr/bin/ps
>      3188    1688    3188       3212  pty0    1001 06:59:16 /usr/bin/bash
>      1688       1    1688       1688  ?       1001 06:59:15 /usr/bin/mint=
ty
>      2392       1    2392       2392  ?       1001 11:00:03 /usr/bin/ssh-=
agent
>=20
> When I type 'ps | grep bash', about 2/3 of the time, I get:
>  	 3188    1688    3188       3212  pty0    1001 06:59:16 /usr/bin/bash
>=20
> HOWEVER, about 1/3 of the time, I get:
>   16832    3188   17792      16832  pty0    1001 16:56:44 /usr/bin/bash
>   3188    1688    3188       3212  pty0    1001 06:59:16 /usr/bin/bash

When you pipe ps to grep, the shell forks and execs two processes, ps
and grep.  What you see is one of the forked bash processes.  They are
shortlived, but depending on the order of execution they may still
linger in the process list when ps creates the process list.

> And there is no bash process launched in the interim. Moreover, this
> second PID jumps around (both up and down) wildly rather than being
> constant or even relatively sequential.

PIDs under Windows are not sequential.

> In such cases, ps -W, similarly generates 2 bash processes:
>=20
>      3188    1688    3188       3212  pty0    1001 06:59:16 /usr/bin/bash
>     16460       0       0      16460  pty0    1001 17:44:29 C:\cygwin\bin=
\bash.exe
>=20
> Even more interesting, when I type 'ps | grep ssh-agent', about 2/3 of th=
e time, I get:
>   2392       1    2392       2392  ?       1001 11:00:03 /usr/bin/ssh-age=
nt
>=20
> HOWEVER, about 1/3 of the time, I get:
>   2392       1    2392       2392  ?       1001 11:00:03 /usr/bin/ssh-age=
nt
>   19176       0       0      19176  pty0    1001   Dec 31 /usr/bin/ssh-ag=
ent

Hmm, I can't reproduce this one.  I tried a hundreds of times, but
there was not a single instance of bash shown as a Windows process.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--FCuugMFkClbJLl1L
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJSZ4f/AAoJEPU2Bp2uRE+g3CkQAJ7hKbFR0nY8QAvKU/QTnbUl
oLTteq0Wc1eoOR5M7Y8VL+BY7svxDCYIbPsUWufFqcbMJpE7FTDQ3xFg0mF+elc5
pMW9uLdsNuKhuBTKrGf3LWk+6sHDr66i/b3cSvXSaQsyV58WYKTF6eOqDIH9efHw
ANTcll2JK1waqpLEVBMd9O0n46ssOOanMaI+pIaS4jSJRKPwDiSylkvYlMua3YL6
k2qNJ5knsgEbysf6SbfEDKzz3e6RLDfAPLQ0UKFUig+vqPG7/3Rntdn3neBk+/xn
L8gDWnh5DfqfSU58G/WUdF7oppvNL5FG+gyEEd2NQizznmLJNHCVjL7qbr/bcEp1
92RhE7uRQ6S3ex8LRQtnj+NCek2hfRyjQz6ReE0XeLNMzg3HH7KdREpeRsnMOk2r
Vx7ZH/hh+4pTp7HwBjy7wjuLaTb4v6mQxmBxeOgiMBDqpfjyb51DOzWQzCVOwMWB
x0xqiIQdIPWdiBIxlxcauuPkhNq85s0hNSHCynS/WIFyb2rRiKdqo5WesTsxeUlP
LQSrQ/6LE/4blLeHDo8FPg0W3B3S/HNN1WAFjXjW+5JgzhiNNlQ56gnQh7HzuilP
evfJglXhi/RGyGpHyj5osO4/mNSYvQxVZZsN7V7WfotCsRwh4eydzAODMa7u4flT
Lsc8MAF98RiaUQoUVXkY
=3tT+
-----END PGP SIGNATURE-----

--FCuugMFkClbJLl1L--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019