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:content-id:content-transfer-encoding :mime-version; q=dns; s=default; b=u249tHQsG3DbnkxnV4Tea1qp2QMGV vNcE7cIPwduaO/5HhV+gdJvNS4JR1j9Z2lcr4NLHYNPU7c7tUaKWq6OwvyNzCrXV N361p+4YZeat/O5z05DFvHak4pG33RDXROOEkNDeoXPf5SPn1oThEkqv200nqPAN 1SAhvzsqY21xZQ= 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:content-id:content-transfer-encoding :mime-version; s=default; bh=Xjh4AGlIXzR4bjt1giQk6P6/BbI=; b=lYf OiHn6JaYI+ec/HKhB0vP7PUanDjyyPVrISoJVKw4WatwFdjWu/+NyFLhw2f75F8q 9vf9d6PohmRA1ZABS0CfZuHXRgx7Rj1ng20rlSMC3rQ3+ZmgU+yD59ndWOp6V7Tl EEOwGprdccTVTnVNyPQGIPm57DNGRlfU/ihqfeUo= 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=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=downloaded, ll X-HELO: NAM03-CO1-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUmu5jK+8piWl0IwO/vNpuDVQ8hhLte6WGIWxfdZMSwCqRXFHbYS+tyjeA4veVRlJTZjZRPXKzOw7VkXntp1NVt0ByEXRPsZGSSktSi9nAUzJW74lKY5wBu6Sb6/t+5WInEXW0WUG3gctBWvBXu0LUlCbKfrz50Pf27+En2Pqkgvr2bV8V944FnBc3UG1ajswD5HcC0VVnyNerwA4Fvx5kOZl3pUh483CiVfRbvLwTdAu4r0/kUgwqe4mhL4ImXM7sByLAffr1r7w0efe4pcAPIyDXCvbT7TZSrje1tk2XcbAgonKbO1tXf5in5+1zOYWidE5ZkKC4KKj++cZNi4XQ== 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=q3Pkga9YlOHpYc6fL2c+E0ggIHAvAQ1Q5yBiaiy4o9E=; b=LF6FZiT9xtglv294oPzjgEOZeNWG3CXPu3ayPCo+vZCP/iuk0WeYw+aok/4r5V/f9/6OcaN5XJc/NtHhllKpDrqLAI96gPOBXE6/tS7YenrRv1P7ANR7zxL3S8Ygf7yyH5dGWVPDQLBwO7E2hF/UBgFdwQnzftAulWWucfTbZlDUTSb4JaRsXNSpdiYRsSrOC1jpwJrInEAv88evxnNRvAFZHZZc8RcvPkpxAsGxCEOoqFYv9a3nHgOQ3CbG0b9wN7Fy4O8QWkI3Z/UB33gA5RCgp+EEtNhMfbcbwuZWC7bE8E17bEz6rxsacgbiHSP8eR43eqpmvSeQ4mN+20dLFA== 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=q3Pkga9YlOHpYc6fL2c+E0ggIHAvAQ1Q5yBiaiy4o9E=; b=feGo+GgExqOuLJws2RvH9dIgqjsm9q6Vjhm05beVxOkP3Ly3cQ+Q19sVVkxHNr4pLauzYmj32Z7ov/MCCYXrO1xHYuFfvmxIZJ9HZb63iekzRDhzVTpHSKLnMtUM5tq4y1NWAHAZSFJCfoNR4a6EKXG1HCGuRbWXRZbC7TM5AXA= From: Ken Brown To: Jon Turney , The Cygwin Mailing List Subject: Re: Regression (last snapshot) Date: Thu, 1 Aug 2019 15:30:09 +0000 Message-ID: <12269538-c387-1f1e-ab5a-b36b60d09937@cornell.edu> References: <20190722164509 DOT GG21169 AT calimero DOT vinschen DOT de> <4b59209a91e8384ec000e2724696791c AT smtp-cloud7 DOT xs4all DOT net> <935d8ce5-fd5c-3010-4664-bb2dc9b7ca2f AT cornell DOT edu> <20190729084552 DOT GL11632 AT calimero DOT vinschen DOT de> <20190729134700 DOT GO11632 AT calimero DOT vinschen DOT de> <20190729152327 DOT GQ11632 AT calimero DOT vinschen DOT de> <20190729154049 DOT GR11632 AT calimero DOT vinschen DOT de> <8e57d4da-722d-1b9a-bd28-5f96ed182f6a AT cornell DOT edu> <0a09679b-1a0f-613b-04c8-1a63da8a00c2 AT cornell DOT edu> <33aead20-540c-ee3b-0d38-ff053fbac040 AT dronecode DOT org DOT uk> In-Reply-To: <33aead20-540c-ee3b-0d38-ff053fbac040@dronecode.org.uk> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu; x-ms-oob-tlc-oobclassifiers: OLM:8882; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 Content-Type: text/plain; charset="utf-8" Content-ID: <7C3B294773D37246AA0B155D298BD61E AT namprd04 DOT prod DOT outlook DOT com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ksb2 AT cornell DOT edu X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id x71FUrdV026917 On 8/1/2019 10:27 AM, Jon Turney wrote: > On 31/07/2019 19:00, Ken Brown wrote: >> On 7/31/2019 11:53 AM, Ken Brown wrote: >>> On 7/29/2019 2:55 PM, Ken Brown wrote: >>>> Here's the error that I can reproduce easily in xterm: >>>> >>>> $ ls <(grep bash .bashrc) >>>> /dev/fd/63 >>>> grep: write error: Broken pipe >>>> >>>> This happens 98% of the time.  Notice that I used plain 'ls' rather >>>> than the >>>> original 'ls -lL'.  With the latter, I get the broken pipe error 60% >>>> of the time >>>> rather than 98%: >>>> >>>> $ ls -lL <(grep bash .bashrc) >>>> pr-------- 1 kbrown None 0 2019-07-29 14:46 /dev/fd/63 >>>> grep: write error: Broken pipe >>>> >>>> What about the explanation I tried earlier, but perhaps not clearly: >>>> ls prints >>>> /dev/fd/63 and then exits, thereby closing the read end of the pipe, >>>> while grep >>>> (running asynchronously) hasn't finished writing to the write end of >>>> the pipe. >>>> >>>> The fact that I get the broken pipe error more often with plain 'ls' >>>> than with >>>> 'ls -lL' is consistent with that.  And the fact that I get no errors >>>> with 'cat >>>> <(grep bash .bashrc)' is also consistent with it, since cat doesn't >>>> exit until >>>> grep has finished writing. >>>> >>>> On the other hand, this doesn't explain why I see the error only >>>> under xterm, >>>> nor does it explain why you can't reproduce it at all. >>> >>> I've made some progress.  It turns out that the problem only occurs >>> in terminals >>> launched from the xwin-xdg-menu tray icon.  I can even launch a >>> mintty window >>> from that icon (System Tools -> Cygwin Terminal) and I'll see the >>> problem.  On >>> the other hand, I can launch an xterm without using that icon (e.g., >>> 'DISPLAY=:0 >>> xterm -l&' from a mintty window) and I won't see the problem. >>> >>> So the issue has something to do with how xwin-xdg-menu launches >>> applications, >>> and how that interacts with bash's process substitution.  I've just >>> downloaded >>> the xwin-xdg-menu source and will see if I can figure out what's >>> going on.  I've >>> also added Jon to the CC in case he has a chance to take a look. >> >> OK, when xwin-xdg-menu launches an application, it creates two pipes >> and sets >> the application's stdout and stderr to the write ends of those pipes. >> For >> example, here's what I see when I launch mintty from xwin-xdg-menu: >> >> $ pgrep mintty >> 5375 >> >> $ ls -l /proc/5375/fd >> total 0 >> lrwxrwxrwx 1 kbrown None 0 2019-07-31 13:37 0 -> /dev/null >> lrwxrwxrwx 1 kbrown None 0 2019-07-31 13:37 1 -> pipe:[38654736160] >> lrwxrwxrwx 1 kbrown None 0 2019-07-31 13:37 2 -> pipe:[42949703456] >> lrwxrwxrwx 1 kbrown None 0 2019-07-31 13:37 3 -> /dev/ptmx >> lrwxrwxrwx 1 kbrown None 0 2019-07-31 13:37 4 -> /dev/windows >> >> These pipes are apparently used for logging. > > That's correct.  Writes to those pipes are drained into the session > logfile (~/.xsession-errors), which you can view with the 'View logfile' > menu item. > >> I don't see how this would explain my observations (grep reporting a >> broken >> pipe), but it is at least a difference between a terminal started from >> xwin-xdg-menu and an "ordinary" terminal. >> >> Anyway, I don't see any evidence here of a Cygwin bug. > > I'm not so sure: these pipes for stdout/stderr of the mintty process > shouldn't have any influence at all on the child bash process (since > it's stdin/stdout/stderr is the slave end of a pty), but apparently they > somehow do? Well, I can't be sure that the pipes are responsible. It's just that the existence of the pipes is the only difference I could spot between an ordinary terminal and a terminal started from xwin-xdg-menu. Is it possible that the logging somehow slows things down or changes the buffering, so that the grep process takes longer to complete? This would be consistent with my theory that the broken pipe error doesn't really represent a bug, but rather it reflects the fact that ls exits before grep has finished writing. Ken -- 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