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:from:to:subject:date:message-id:references :in-reply-to:content-type:mime-version; q=dns; s=default; b=Iy72 fhi8z5GiugsXmLY6IHk1GvsW2M+zIxUDe3AlvP9WMMpifR4zsn59RGRJXbtjes5C eVS1hMufyorOVpYEFahJn0NMcgx3QZmfz6dBp1vEobIg4E9u67FuCNvxJyUUU38B sO/efK2jrPr4kTIFIC1NlCZgk88nEPW8SAqUjL4= 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:from:to:subject:date:message-id:references :in-reply-to:content-type:mime-version; s=default; bh=HEFd6wqoUh WYpbfldx8U8Hq6Vm0=; b=NzN+evwE2fIDwtjMaWGPNEBXZM44jDPD3aR+PLOMd+ sOcN727rDCTDZZx6eV1EE5lMSpuDrV2AOOGMpd/jrDf1hP2nNA4TmA8ioevfFx7G Dw+NvaltidneT3pLoowbBHIY74DpmG6h+3YtCjsH30et6TaYzfYhkDH/fD/2tK6v c= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=Brown, H*c:HHH, agent, aid X-HELO: NAM01-BY2-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d9XJb6O7/uRTnJfZQhnRkrUmLQtu/qkwZ7Cow6sSuCtZNQAUWdDPHAv1u1hzehJJzLfmgqKKMq3GNZhgu6mRvpA7r5dfmhzLlm/c7KS9SjCp+2DSUobymUwNwb/5BZcjltzbA6w4ieZmY6NdgZ5qEvdsuBG7wyMOCiP/JnbRqHqlErdNoL82XLD/jR2nxh6whADE37K22oWYnMWXaVpaiFh7uQtHDWeIMNDnau4hZaUbknBNo4skF1KuhlJ+MgbwKIXYCUapj9sw/w6Z1R2FT9g3wCJOyOO6O0ASkAkpFN651M6Kn7EeI5VAF0w9Q1EPIvY0SpC1K90iDllsivlqoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/YVDSjxyS5wVTIk8HWQ7ncSY8hxA1Ej2ZsJfozXGz3M=; b=a0otZ4sXcRMvlRnyNOgmRkvS7ZPz2j+X3HFibZI/WIIwM0uZ9Ex1zfhI7vexP/uBdAPfoKuz/YtTpC1DmUveJeU2gfgUXAliYf3rOlF3qfXaR/SByFpsET29mmse8K5eV50IjX+cyNyBUMQy3QS6DRPmyDE/m+qYaJXdqilxQFvxyE/9qmVVurY/NkYkMoy3GxX2FMlaW0E0rdTcmWMP8z3TIS/VevCLBal3KR9yIlphoaEtiPwTSu+CdyCEBY/z7P4ZRIMLW+4cjIWLWpp3RRshlTLkMFThH6zqnN2avxoTYsE3zdhGJSzWouFF8h0Ta8b5hENm8hFJJApYSthWQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/YVDSjxyS5wVTIk8HWQ7ncSY8hxA1Ej2ZsJfozXGz3M=; b=d9vShnmgZJ14Sn6B2y94vaER3eTfjn8h8fMJUGNC1XcEVu2MW1eSgdbRPnfsk3embUv7YR1rEYUxNxzitFcTYUEjSkkxUMNJCv99Sy5AHXoMTDCKzh5tLCA7uYii5Oz5DV2JH4Fb7HsmMXGHayAMeJpNUiDEWBxYRa1eoX4Zb48= From: Ken Brown To: "cygwin AT cygwin DOT com" Subject: Re: ssh-agent doesn't die Date: Sun, 29 Sep 2019 20:05:44 +0000 Message-ID: <185c5774-dd8b-5488-b818-4cec5a24bf2d@cornell.edu> References: <319e26c0-32f0-40b7-2137-c7de170a3486 AT rl DOT ac DOT uk> <5b225738-c2d7-fbfe-48a7-8c2a38c3398c AT cornell DOT edu> <0ccd17b6-c22a-1a18-9409-1ebcfae60868 AT huarp DOT harvard DOT edu> <9f7a14bb-f81b-c566-bb84-8da7fc6d0fad AT cornell DOT edu> In-Reply-To: <9f7a14bb-f81b-c566-bb84-8da7fc6d0fad@cornell.edu> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu; x-ms-oob-tlc-oobclassifiers: OLM:7219; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True Content-Type: multipart/mixed; boundary="_002_185c5774dd8b5488b8184cec5a24bf2dcornelledu_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: THRgj45clm0K/TUlrZXAoqw9V+VKfNK4s/t0lLJXvhtc64f/AFljCsKK7SGyzg1dY/usmO0fcAn2MjAczj7rkg== X-IsSubscribed: yes --_002_185c5774dd8b5488b8184cec5a24bf2dcornelledu_ Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable On 9/27/2019 10:12 AM, Ken Brown wrote: > On 9/27/2019 9:37 AM, Norton Allen wrote: >> On 9/26/2019 10:50 PM, Ken Brown wrote: >>> >>>> As a simple test example, consider: >>>> >>>> /bin/ssh-agent /bin/sleep 10 >>>> >>>> While the sleep is still running, ps shows: >>>> >>>> =A0 =A0=A0=A0=A0=A0 PID=A0=A0=A0 PPID=A0=A0=A0 PGID=A0=A0=A0=A0 WINPI= D=A0=A0 TTY=A0=A0=A0=A0=A0=A0=A0=A0 UID=A0=A0=A0 STIME COMMAND >>>> =A0 =A0=A0=A0=A0 1694=A0=A0=A0 1693=A0=A0=A0 1694=A0=A0=A0=A0=A0=A0 1= 576=A0 ?=A0=A0=A0=A0=A0=A0=A0=A0=A0 22534 00:01:10 >>>> /usr/bin/ssh-agent >>>> =A0 =A0=A0=A0=A0 1653=A0=A0=A0=A0=A0=A0 1=A0=A0=A0 1653=A0=A0=A0=A0= =A0 11740=A0 cons1=A0=A0=A0=A0=A0 22534 00:00:37 /usr/bin/bash >>>> =A0 =A0=A0=A0=A0 1693=A0=A0=A0 1653=A0=A0=A0 1693=A0=A0=A0=A0=A0=A0 1= 552=A0 cons1=A0=A0=A0=A0=A0 22534 00:01:10 /usr/bin/sleep >>>> >>>> One oddity is that ssh-agent is listed as a subprocess of sleep >>> ...but this isn't a bug.=A0 ssh-agent forks, and then the parent execs = the command. >> >> With the salient difference presumably being that the exec is done in th= e parent >> instead of the child as usual? >=20 > Yes. The idea is that 'ssh-agent command' should be more-or-less equival= ent to > running 'command', with ssh-agent running as a subprocess. >=20 > The ssh-agent subprocess periodically checks to see if its parent is still > alive, and it exits when the parent has died. Someone should figure out = why > this is not working on Cygwin. As an aid to someone who might want to debug this (probably Corinna when sh= e=20 returns), I've created a test program agent.c (attached) that simulates the= =20 relevant part of ssh-agent: 1. It forks a subprocess that periodically checks to see if its parent has = died,=20 and then exits. 2. The parent execs "/usr/bin/sleep 1". As with ssh-agent, the subprocess never detects that the parent has died, a= nd so=20 it never exits. Running this program under strace shows the following error in the pinfo=20 constructor: pinfo::pinfo: couldn't duplicate parent rd_proc_pipe handle 0x1BC for forke= d=20 child 1666 after exec, Win32 error 5 [Win32 error 5 is ERROR_ACCESS_DENIED.] I assume this is the source of the problem, but I don't understand the code= well=20 enough to know why. I also don't know why the call to DuplicateHandle fail= s. Ken --_002_185c5774dd8b5488b8184cec5a24bf2dcornelledu_ Content-Type: text/plain; name="agent.c" Content-Description: agent.c Content-Disposition: attachment; filename="agent.c"; size=694; creation-date="Sun, 29 Sep 2019 20:05:44 GMT"; modification-date="Sun, 29 Sep 2019 20:05:44 GMT" Content-ID: Content-Transfer-Encoding: base64 I2luY2x1ZGUgPHVuaXN0ZC5oPg0KI2luY2x1ZGUgPHN0ZGxpYi5oPg0KI2lu Y2x1ZGUgPHN0ZGlvLmg+DQoNCnBpZF90IHBhcmVudF9waWQgPSAtMTsNCg0K dm9pZA0KY2hlY2tfcGFyZW50X2V4aXN0cyAoKQ0Kew0KICBpZiAocGFyZW50 X3BpZCAhPSAtMSAmJiBnZXRwcGlkICgpICE9IHBhcmVudF9waWQpDQogICAg ew0KICAgICAgcHJpbnRmICgiUGFyZW50IGhhcyBkaWVkIC0gYWdlbnQgZXhp dGluZy5cbiIpOw0KICAgICAgZXhpdCAoMik7DQogICAgfQ0KfQ0KDQppbnQN Cm1haW4gKCkNCnsNCiAgY2hhciAqY21kW10gPSB7ICIvdXNyL2Jpbi9zbGVl cCIsICIxIiwgTlVMTCB9Ow0KDQogIHBhcmVudF9waWQgPSBnZXRwaWQgKCk7 DQogIHBpZF90IHBpZCA9IGZvcmsgKCk7DQogIHN3aXRjaCAocGlkKQ0KICAg IHsNCiAgICBjYXNlIC0xOg0KICAgICAgcGVycm9yICgiZm9yayIpOw0KICAg ICAgZXhpdCAoMSk7DQogICAgY2FzZSAwOg0KICAgICAgLyogY2hpbGQgKi8N CiAgICAgIHdoaWxlICgxKQ0KCXsNCgkgIGNoZWNrX3BhcmVudF9leGlzdHMg KCk7DQoJICBzbGVlcCAoMSk7DQoJfQ0KICAgICAgYnJlYWs7DQogICAgZGVm YXVsdDoNCiAgICAgIC8qIHBhcmVudCAqLw0KICAgICAgZXhlY3ZwIChjbWRb MF0sIGNtZCk7DQogICAgICBwZXJyb3IgKCJleGVjdnAiKTsNCiAgICAgIGV4 aXQgKDEpOw0KICAgIH0NCn0NCg== --_002_185c5774dd8b5488b8184cec5a24bf2dcornelledu_ Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --_002_185c5774dd8b5488b8184cec5a24bf2dcornelledu_--