From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#56025: 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin Date: Thu, 23 Jun 2022 21:18:24 -0400 Message-ID: <040b3a36-459b-a94d-f879-7f45aac50bda@cornell.edu> References: <8e21db9c-0100-998e-f280-81304e7ff61a@cornell.edu> <87mtecl82o.fsf@athena.silentflame.com> <40d9e52f-2041-b341-ff77-546ca7792791@cornell.edu> <87k09elrf8.fsf@athena.silentflame.com> <1de33903-4c55-e043-3754-726f7044f2d0@cornell.edu> <7e7daa2f-dbbc-cd0a-4958-2a2932b17837@gmail.com> <8974408d-91cd-aebd-7a5b-596a57bd640e@cornell.edu> <17d41105-b006-f9ad-af0b-ece84a7f5248@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18955"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 To: Jim Porter , Sean Whitton , 56025@debbugs.gnu.org, Lars Magne Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 24 03:19:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4XyX-0004iZ-Np for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Jun 2022 03:19:10 +0200 Original-Received: from localhost ([::1]:58916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4XyW-0006vV-9A for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jun 2022 21:19:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4XyP-0006vM-WD for bug-gnu-emacs@gnu.org; Thu, 23 Jun 2022 21:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4XyP-0005nG-Oh for bug-gnu-emacs@gnu.org; Thu, 23 Jun 2022 21:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4XyP-0004we-KX for bug-gnu-emacs@gnu.org; Thu, 23 Jun 2022 21:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2022 01:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56025 X-GNU-PR-Package: emacs Original-Received: via spool by 56025-submit@debbugs.gnu.org id=B56025.165603351918971 (code B ref 56025); Fri, 24 Jun 2022 01:19:01 +0000 Original-Received: (at 56025) by debbugs.gnu.org; 24 Jun 2022 01:18:39 +0000 Original-Received: from localhost ([127.0.0.1]:40354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Xy2-0004vv-Ny for submit@debbugs.gnu.org; Thu, 23 Jun 2022 21:18:39 -0400 Original-Received: from mail-mw2nam10on2116.outbound.protection.outlook.com ([40.107.94.116]:26209 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4Xxy-0004vf-DI for 56025@debbugs.gnu.org; Thu, 23 Jun 2022 21:18:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iTMoRgIaxWhfROeaQPBy46FvkOsYq+5yUZXgv7n2zsKZtU0xMOjfOVR7j9YJYljQQJ5UbYGmcPa8fUgAa69eUO5rjClMF77Sr7BQDNBtC0OClHKAXE1yCkkOzqY6OuOD380OS0A9958luawGzmdRtNrh01nidYCOVMwiDiKt1ZYiyh4FaQJQ9nYn4xJt5ZFzUVK9cv0xDJRj+MYRa5jfBYx8XH+96q6oSLhSKC6hAlMVAzh0kqcNoIsTzvRUxpcQmOuzK05vdRQxirf75pENkL9LGh9MObaHXtXunnzesE/r9ghTDlUNhNAqQ8+1BkyvHToFfkP4u/vdxeMYtPOVeg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YMnChw3nKdEGTG/EUS5QfFmkBXkhukMbx15N6PzqfRM=; b=SPo6wcOLuatDxMy/J6Z+31aQRH73kVrgAiqme+BFEwwpKmv45zKwjOvQp16dbVSRyqDW8zc7+AO4mZgoN2UtF6J/3q9Q1NaZT1cReaFT1K8YaMiQTvJQ02jrir9umeJuWysLIq0xUUXtAV/5i3n8GoftAfwjRGcZSlSCR94n50Z2/crAxeE0ZlsMOT5/RM/TTbRr084FpnKyKtbujV1EB/4JY7Q964u4gDLfRuwGKuDykscltye1ikN/Tr5rndMA5pdkL2DG7Q8bAOCwW09Gs6Rapv8QLnePJ48wjcE0DCwA+BWKJSOjGaOG2umlHc0OcG/ujQWdmvcSl2dB8VNrSg== 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=YMnChw3nKdEGTG/EUS5QfFmkBXkhukMbx15N6PzqfRM=; b=SF0uGxOINnd2AXJWt3v0MU5Uv7l1+lrLx2emLoMvPmcs0pka+HMx8PSPDkKHKyUpGIZCejQE1CX5mRmAQnHxs7LBjGZ5NSQkK81kp/UCRiTOm8LnU+KFrvLGNGhs0WcmmRH5YsBd2m16RmUZBLEZf7D4b3F+Edz1KHorUBcuavM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cornell.edu; Original-Received: from BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) by MWHPR04MB0927.namprd04.prod.outlook.com (2603:10b6:301:46::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.21; Fri, 24 Jun 2022 01:18:27 +0000 Original-Received: from BN7PR04MB4388.namprd04.prod.outlook.com ([fe80::901f:a758:30f5:309d]) by BN7PR04MB4388.namprd04.prod.outlook.com ([fe80::901f:a758:30f5:309d%2]) with mapi id 15.20.5373.016; Fri, 24 Jun 2022 01:18:27 +0000 Content-Language: en-US In-Reply-To: X-ClientProxiedBy: BL1PR13CA0007.namprd13.prod.outlook.com (2603:10b6:208:256::12) To BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 159b8cea-26f0-4882-d888-08da557f70d9 X-MS-TrafficTypeDiagnostic: MWHPR04MB0927:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MgbFBQfLAV7JDVNhAWMmSE1BWY1o0vMnsb1kQoDLQB+f920BsIEXc+OlFJmy/nObcL/8gj3j89l1akLBzb+CHYIxIB5Pte/P111a4hQgoET+OzTDcd+A4zLg7E8bQTDvEEGucwuH/R3xUA8KyrJXptwt0tPHoY5f8x1rxecxMSOaFhXV/actgwACDu5LNH7Lxuz4Y4WMx6Cs9R1UIF2hWMVjs375rVLyzCSWdp4tVeqQDCUe2bWJ2Y3LLP+zL8g85wft0hIqEDQm9D5rFBpxX+zlR5k3vTSgTCsRxTjeJV89Z6692d5m6ScR0bZgVIn+P4S85eNIpUFF3LPuJpuVmjgLL+G8wdZ734QwVm5EdgTl2ou/xA48xwcY6gg2NgLbEANov0JD5hGyS7mz6kHjtlkPW+OxYHGGfsStmLmHreFk5+/827Sdp15guLG7rY2OpoAs0r9bc7tGuQekqMxHLeo2UxJxJ5vcgjiExEbLLFAw2dLce+n2LUz4HBIDVQpCZhtaBQs/lcEmtPOVwTvfB426u3uYHzcxilWKCi4V0ccoIchtIRX26axVul1dFDpdXgHfNATN/4j/lei9qkvCVmyS5SCRq3OSdZ3AX0KCKe2pu22mv3I9by1id3UCRYAvXA3vmd7zN13NSkLSwTup7XzdgL0rO+vnCa3Ecc3zyoXNpJ9IMjaU5f68+DD4JMLs6cgsuXKOv1vZXDMn2VIfen/CC3aLlngoh6zuix+ZIwAoSzxKwCHtq+qkHdr39 uTvuJnOmrKfZdsdwDhJZcAibxPWHkRRE8Qi3pJr7Hx1pvnxYi5XaR/Tet06MPDXdR87iIeE51d2PSr+W4x6awwq6YV95+9aF2d X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(39860400002)(366004)(376002)(396003)(346002)(316002)(8936002)(6666004)(41300700001)(6512007)(8676002)(41320700001)(478600001)(38100700002)(2906002)(36756003)(6506007)(6486002)(110136005)(966005)(53546011)(2616005)(66476007)(186003)(66946007)(786003)(5660300002)(75432002)(31686004)(66556008)(31696002)(86362001)(83380400001)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cLMwvsU2b5c5QP5v1awsUQ9/KS9IQ4Eygv2hfgOu1eIboJL6zlBf8oRKNSIVoiwLkLO3OHEaIzlbWl/uAdU2/FXjd9XisNNkiBRKkraeB154BUbAu9jw8B7FzAIfVH1gMitYZAYEGxHnEe4ijamJXtz0MthaHgZg6andCJskXbz8Dy3QSRQpwIOStJ+If/6mUX2++VO6tcloqbe+8yV5K07dtDPCzZaZpHE2omxoNAN2GMHJbauTsXe9uzp5vn0HTiBO4KI1rO3mJByHyrjMAmg3S1G8TtA77pCwTnOTazX2+Xk+5Pq4xZgKFTK60rlNM87FMbXwyEPUWsf2ea57BptcqZDiJC0h88jjd33Zz3AZ1WdPVJAazGVv+KYrAN6wQxESz+BuuWPGYRmTg/idKTYI0YlFtgUOjLc54FxMA5uQMuyY2JTVNEkVxsOLuZF98Gj1VueLl3s+cogEuZXcSTQApfLXrDm1b9+iJhjtz7rEfvJYQK20Rs0Kwe9ZjETCVme3AGkj0fHd9ladslXVfeu4gYcnh/Tw9scuaVlvAdiVUSmfyfVW3/mtF5cdxLN4zVylo84MSvdqPBQGqR00QNapqdUt12k1nTBCRK2CB0zy342fSGivmDNWM4MU1cXK5E6NEkPyhIQo9wcvV+FhdYqW7DIHEHBfvrZT0EP7CdIohyScFx0OdWrqeef6OEPO7uOPITd4cqui/1itRq6fhoDCqLYGVwNbmNrXiiC66TP6OnIUiWtx7kShoV q4V/FWEAdJ6iYwBsiqx/UycMWbQR+Th4C95Gg2Ztgwgq8r+zowFjmb32wqs6Z/7UpMh3N8FG3zUn822Y2eHNOPloS3becoLDpJ X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 159b8cea-26f0-4882-d888-08da557f70d9 X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 01:18:27.0753 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XfAIt9DubyW519x3d8pLfgpdRtWb+QV16QTUniUi7nZALGJotw+H6yUY9dZ6kdp6FmvUUEFQQQ8EpPGiAf7bNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0927 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235143 Archived-At: On 6/19/2022 12:02 PM, Ken Brown wrote: > On 6/18/2022 6:00 PM, Jim Porter wrote: >> On 6/18/2022 1:51 PM, Ken Brown wrote: >>> On 6/18/2022 3:02 PM, Jim Porter wrote: >>>> On 6/18/2022 10:52 AM, Ken Brown wrote: >>>>> No, I'm seeing the same results on Emacs 28.  On both Emacs 28 and Emacs >>>>> 29, rev is apparently not seeing EOF unless echo outputs a newline, so rev >>>>> keeps waiting for input. >>>> >>>> Ah ha! Thanks for debugging this. The minimal fix then would be to change >>>> the command in em-extpipe-test-2 to either of these: >>>> >>>>    echo -N "bar" | rev *>temp >>> >>> This doesn't work.  It still hangs when run interactively... >> >> Just to confirm, the above command hangs, but the following works, correct? >> >>    echo -N "bar" | rev > > Correct. > >>>>    *echo "bar" | rev *>temp >>> >>> This works interactively... >> >> All this makes me think that we could be dealing with a race condition in how >> Eshell pipes I/O around. Maybe there's a timing issue in `eshell-close-target' >> where we end up not sending EOF to the "rev" (or "sh") process? > > I think I've just discovered an anomaly in "rev" on Cygwin that could partially > explain what I'm seeing.  I'll investigate that before proceeding further. OK, I think I've got it sorted out now. The anomaly I referred to above is actually an anomaly in the stdio routines, not in "rev". It's discussed in item 2 below. There are two issues. 1. I think there's a bug in eshell-close-target, in which it's assumed that sending C-d indicates end-of-file. This is only true if there's no input waiting to be read. [In an interactive situation, this means we're at the beginning of a line.] Otherwise, it takes a second C-d to indicate EOF. So one C-d should suffice in the "echo -N bar" situation, but two are needed after "echo bar". This bug probably went unnoticed because eshell-close-target was called twice in the case we were discussing, so process-send-eof was called twice. 2. On Cygwin and some other platforms, including Solaris 11.4 I think, it actually takes a third C-d, for reasons explained in the email thread starting at https://cygwin.com/pipermail/cygwin/2022-June/251672.html. We're probably going to change this on Cygwin, but that still leaves other platforms. The following patch resolves both issues: diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 3644c1a18b..1c4131cb07 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -276,8 +276,8 @@ eshell-close-target ;; If we're redirecting to a process (via a pipe, or process ;; redirection), send it EOF so that it knows we're finished. ((eshell-processp target) - (if (eq (process-status target) 'run) - (process-send-eof target))) + (while (eq (process-status target) 'run) + (process-send-eof target))) ;; A plain function redirection needs no additional arguments ;; passed. I'm about to go AFK for a few days. If the eshell people agree that something like this patch should be installed, please go ahead. I think it would then be worth re-enabling the extpipe tests on EMBA to see if the problem is fixed there too. Ken